|
You are converting the sum to int before adding every value. Int(0.5) + 0.5 = 0.5
You don't have to convert the sum at all, you already know that it's a number.
---
b { font-weight: normal; }
|
|
|
|
|
Why should converting it keep it from adding like numbers
for example if i change the values to .51 and .52 i will get 1.03
if i try to add .50 and .50 i get .50
|
|
|
|
|
hi in vb6 there was controll known as the microsoft internet controll that used to display web pages. is there is any similar controll in .net to display the web pages.
Tasleem Arif
|
|
|
|
|
Yes, there is one. If you are using the .NET Framework 2.0, you can use the builtin Webbrowser Control. Otherwise, you can use the WebbrowserEx Control mentioned here.
Yuvi Panda T
Microsoft Student Partner
Blogs at : http://yuvipanda.blogspot.com
|
|
|
|
|
I'm trying to add support for Oracle ODP.Net Bulk Data Binding to an existing component that looks a lot like the Data Access Application Block in Patterns & Practices' Enterprise Library.
My problem is that an unknown (at compile time) number of arrays of unknown types can be passed in based on the database columns that are to be populated.
When I try to cast an array element to String:
dbParam.ArrayBindSize(i) = Convert.ToString(dbParam.Value(i)).Length
or
dbParam.ArrayBindSize(i) = CType(dbParam.Value(i), String).Length
or
dbParam.ArrayBindSize(i) = dbParam.Value(i).ToString()).Length
to get it's length, the compiler complains:
Option Strict On Disallows Late Binding .
I know I'll get a lot of resistance if I suggest turning Option Strict Off. Is ther any other way to circumvent the compiler?
Thanks In Advance.
Will
|
|
|
|
|
Hi there,
I just begun to try out the generics stuff and start realizing the huge range of possibilities this feature offers.
However, I got a question in this context:
Let say I have a class (which I don’t know during design time) with two properties: one of Boolean and another one of String.
Then I got a generic class like:
Public Class Something(Of T)
I’m looking for an elegant way to create instances of the generic class during runtime depending of the data types of the properties of the first class like:
Dim Instance1 As New Something(Of Datatype of the first property) --> Boolean
Dim Instance2 As New Something(Of Datatype of the second property) --> String
Thanks in advance for any hint!
Rudi
|
|
|
|
|
If you are trying to select the data type dynamically using Generics, that is not possbile. The data type has to be known at compile time, or the compiler can't create the code for the Generics. The entire point of Generics is that the code is created for a specific data type so that it is efficient and type safe.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for the quick reply, Guffa!
No, I’m actually not trying to "change" the data type during runtime. Let me explain how I would do it the “common” way:
Dim Instance1 As New Something(Of Boolean)
This is what I can do at runtime within a method of course.
If I now have a variable like
Dim SomeString as String
my intention now is to
Dim Instance1 As New Something(Of <the same="" data="" type="" like="" somestring="" is=""> )
May be this is a bit more clear now.
|
|
|
|
|
I don't see the problem? SomeString is a string, you know that. Why not just:
Dim Instance1 As New Something(Of String)
---
b { font-weight: normal; }
|
|
|
|
|
No, sorry the sample was just meant to simplify the problem. At run time I just know the name of the variable not the data type, it could be everything. I can get the data type by reflection but I don’t know the syntax to use for
Dim Instance1 As New Something (Of data type of the variable I’ve got by reflection)
|
|
|
|
|
The data type has to be known at compile time. You can't get a data type using reflection and use that to create a generic object.
---
b { font-weight: normal; }
|
|
|
|
|
A great pity! It would solve some of my problems.
Anyway, thanks a lot for your support Guffa!
Rudi
|
|
|
|
|
i dont need to write in note pade and the another application read from it. i need to use the sendwait() method but the problem what happed ? really i dont know maybe i shoudl add timer to the button action to slow down the transfer of data from vb.net to another application ..so i need the solution .. because i work with seminar project and i have a 1/5 as a dead date .. the problem is transfer a data from vb.net to another application without any changes of data..
please i send more than 12 to get the answer but still at this moment without a correct soluation...please help me.
in the subject example the first time will print 08052 and the second maybe 080052 and the third maybe 0855520 and th fourth maybe 08052 but why doesnt print the correct data in each time click on the button "080052" doh:
kilany
|
|
|
|
|
i still wait the answer ... if you dont have a anwswer just tell me.. because i hate the wait time
kilany
|
|
|
|
|
Hello,
i need help to know how can i post XML to XML web service url, it should be easy for someone who worked with XML web services:
I need to post this sample xml data:
<catalogrequest xml:lang="en-US">
<xmlpassword>myxmlpassword
after posting i would like to receive the data and save it to xml file, it would contain hunders of records.
Please need the code to work on VB.NET application.
here is all i have about this xml web services any help would be approciated to get a code that i can get and download/save the xml response Thanks:
Download the catalog
To download the catalog, you must form an XML CatalogRequest and send it to your cobranded site's XML URL. This URL can be found on the 'Site Setup' tab under the 'General' sub tab. The XML URL will look similar to the following URL:
http://p7d6.arixmedia.com/xxxxxxxxxxxxxxxx/xml
Where 'xxxxxxxxxxxxxxxx' is the cobranded site's numeric ID. The specification for CatalogRequest is documented in the next section in Table 1: CatalogRequest Specification. Below is a sample CatalogRequest:
<catalogrequest xml:lang="en-US">
<xmlpassword>myxmlpassword
<lastupdated>2005-09-21 06:00:00
In the above example our XML password is 'myxmlpassword'. We also only want items that have been added or updated since 6:00am on 9/21/2005.
Once the CatalogRequest has been sent to the server, it should respond with a CatalogResponse, which contains the actual catalog data.
Note: When sending your CatalogRequest to the XML URL, make sure you use a method that provides a valid User Agent string. If you are using CURL/PHP, you can use the following code to do this:
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
where $ch is your CURL session handle.
Storing the data
Once you have received a CatalogResponse, you will need to save the data to a local database. The procedure for doing this will vary depending on the scripting language or application you are using to download the feed.
You will also need to save the value of 'LastUpdated' from CatalogResponse/CatalogInfo, as this will allow you to retrieve incremental updates for subsequent CatalogRequests as opposed to the entire catalog.
Note that a CatalogResponse may contain items that already exist in your database, as some items may have been changed or updated since your last CatalogRequest.
Samer
|
|
|
|
|
here is the xml again,
the forum reads it as HTML tags:
?xml version="1.0" encoding="ISO-8859-1"?>
CatalogRequest xml:lang="en-US">
XMLPassword>myxmlpassword
LastUpdated>2005-09-21 06:00:00
/CatalogRequest>
Sam
|
|
|
|
|
There's no way we are going to give you the code for this. You have apparently made no attempt at solving it yourself. This forum is for help with programming problems - not doing your assignments for you.
If you need help with one or two problems related to the assignment then that's fine - we're only too happy to help - but we won't do it for you.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Steve yes i tried working on it but i have had no clue what is that or how it does work, im programer and i know well about coding and trying.
anyway i got to do it with a help from a friend in php thanks
Samer
Samer
|
|
|
|
|
In the present code, we use a datagrid as a container to print data from a SQL database. The following gets data (via ODBC) in the SQL database and save it in a DATASET.
Public Function GetDatasetGiveSql(ByVal sqlCmd As String) As DataSet
Dim dataset As New DataSet
odbcCmd.Connection.Close()
odbcCmd = New Odbc.OdbcCommand(sqlCmd, odbcConnection)
odbcAdapt = New Odbc.OdbcDataAdapter(odbcCmd)
odbcCmd.Connection.Open()
odbcAdapt.Fill(dataset)
Return dataset
End Function
Elsewhere in the software, the software builds a query and sends it to the database like this:
dsCommand = sql.GetDatasetGiveSql(cmd)
DataGridCommand.SetDataBinding(dsCommand, "Table")
As you can suspect, dsCommand is a DataSet and DataGridCommand is the DataGrid to update.
Easy to date… OK.
Question:
---------
I want to have control on the background and foreground color of a cell based on some information like any people in this forum. I found many EXAMPLES with DataGridColumnStyle where the idea is to override the Paint method (aka: make a custom datagrid control). Yes, Perfect. I understand it BUT in this case… I DON’T CONTROL ANY COLUMN in the datagrid. It seems that the SetDataBinding() does everything by itself, it is magic.
I did not find HOW to OVERRIDE the Paint() method of this datagrid. Maybe I don’t understand something !
Danny Gilbert, enginneer
Montréal, Canada
Danny Gilbert, enginneer
Montréal, Canada
|
|
|
|
|
Hi Danny
I found a class on the net that changes the cell color according to what
information is placed in the cell, is this what your after? Below is how
I used it. Instead of a basic color I actually used a linear graded color in the cell, looks great in the grid.
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
Public Class DataGridColoredTextBoxColumn
Inherits DataGridTextBoxColumn
Public Sub New()
'Warning: Implementation not found
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
' the idea is to conditionally set the foreBrush and/or backbrush
' depending upon some crireria on the cell value
' Here,we color anything that matches the select case
Try
Dim o As Object
o = Me.GetColumnValueAtRow(source, rowNum)
If (Not (o) Is Nothing) Then
Dim c As Char
Dim cellStr As String
c = CType(o, String).Substring(0, 1)
cellStr = CType(o, String)
Select Case cellStr
Case "**CRITICAL**"
backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 50, 25), Color.FromArgb(128, 20, 20), LinearGradientMode.BackwardDiagonal)
foreBrush = New SolidBrush(Color.White)
Case "- URGENT -"
backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 255, 255, 0), Color.FromArgb(200, 10, 0), LinearGradientMode.BackwardDiagonal)
foreBrush = New SolidBrush(Color.White)
Case "current"
backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 10, 255, 0), Color.FromArgb(0, 50, 0), LinearGradientMode.BackwardDiagonal)
foreBrush = New SolidBrush(Color.White)
End Select
End If
Catch ex As Exception
' empty catch
Finally
' make sure the base class gets called to do the drawing with
' the possibly changed brushes
MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)
End Try
End Sub
End Class
It gets called like this.
Dim numCols As Integer
numCols = Me.m_openQueries.Tables(0).Columns.Count
Dim aColumnTextColumn As DataGridColoredTextBoxColumn
Dim i As Integer
i = 0
Do While (i < numCols)
aColumnTextColumn = New DataGridColoredTextBoxColumn()
aColumnTextColumn.HeaderText = m_openQueries.Tables(0).Columns (i).ColumnName
aColumnTextColumn.MappingName = m_openQueries.Tables(0).Columns(i).ColumnName
table_style.GridColumnStyles.Add(aColumnTextColumn)
i = (i + 1)
Loop
Hope this helps
cowtech
|
|
|
|
|
Thank you very much, I will try it.
Danny Gilbert, enginneer
Montréal, Canada
|
|
|
|
|
Hi Danny
Just wondering how you went with this.
cowtech
Sydney Australia
|
|
|
|
|
I have an MDIList menu item that I want to enumerate at run-time and possibly change the text shown for some of the MDI children included in that list. When I enumerate the collection for that menu item, none of the open MDI child windows show in the list although they are clearly there in the actual drop-down of the menu item. Does anyone know how I can enumerate the menu item that contains the MDIList at run-time and change the text associated with some of the MDI children in that list?
Thank you.
|
|
|
|
|
I have a ActiveX control created in VB 6 from a 3rd party and wanted to use it in ASP.Net/VB.Net but the control dosent expose APIs which could be called from ASp.Net/VB.Net. I tried invoking the function from javascript but later foudn that some functions on the OCX were not even exposed to javascript. So the tech support (who do not provide support for .Net) suggested that we create another wrapped OCX around theirs, and use that OCX within our web pages. So far so good.
We did as they said, created our own OCX, doing whatever we wanted to. We then tested it out on .Net 1.1 and the control worked like a charm. But when we attemp to use the same control in VS 2005 (prfessional edition), the control does appear in teh toolbox pane, but is disabled, and does not allow itself to be placed on any page. in VS 2003 we are using it normally without any issues.
Can you plz guide me as to what might be the problem.
|
|
|
|
|
Hi.
Can anyone help me with the problem I have. I need to write a program that will monitor user activity: file open, deleted, renamed, on the server. But most important I need to know WHO actually did it (user name).
I was able to write code (windows service), using FileSystemWatcher, that can monitor directories on my computer and even was able to parse it by extensions.
The problem is I cannot get user name who changed, deleted, created files. As soon as I install my windows service it returns SYSTEM as user name for me.
I looked for other programs but they can't give me user name as well. Like
http://www.sysinternals.com/Utilities/Filemon.html[^]
Did anyone have any experience with this? Any suggestions are appreciated.
Thank you,
|
|
|
|
|