|
-
Apr 1st, 2004, 04:45 PM
#1
Thread Starter
New Member
alias for Val() function ? [RESOLVED]
is there an VB.Net alias for the vb6 - Val()- function
(convertering string to integer)
thx in advance
Last edited by Object; Apr 4th, 2004 at 09:32 AM.
2 things are infinite! the Universe and human stupidity =-)
-
Apr 1st, 2004, 04:54 PM
#2
PowerPoster
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Apr 2nd, 2004, 12:23 PM
#3
Sleep mode
Look at the static Convert function .
-
Apr 2nd, 2004, 09:32 PM
#4
PowerPoster
Integer.Parse() is another way.
-
Apr 3rd, 2004, 02:38 AM
#5
Thread Starter
New Member
Hi again ,
I can't use the others functions?...
this is what i want todo ...
Code:
Private Sub btnInp32_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInp32.Click
txtInp32.Text = Convert.ToString(InP(Val("&H0378")))
End Sub
this calls following function in another class :
Code:
Declare Auto Function InP Lib "inpout32.dll" Alias "Inp32" (ByVal portAddress As Integer) As Integer
and this is the error i getting :
Code:
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Input string was not in a correct format.
he takes the string only with the old Val() function ?
And because i want to be part of the DOT NET hype
i'm looking for the .Net function .....
THX for your time and effort
2 things are infinite! the Universe and human stupidity =-)
-
Apr 3rd, 2004, 03:31 AM
#6
PowerPoster
Hi,
I'm afraid that as far as I am concerned you are creating a thick fog!!
The error message you get indicates that the parameter passed to mscorlib.dll is at fault. You don't show us your calling routine nor the code of mscorlib.dll.
Along the way in
txtInp32.Text = Convert.ToString(InP(Val("&H0378")))
You take a string; convert it to a number; then convert it back to a string using a function "InP" of which I am totally ignorant.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Apr 3rd, 2004, 03:50 AM
#7
Sleep mode
What does that API do ? There's maybe function that does equivalent job in .NET .
-
Apr 3rd, 2004, 08:00 AM
#8
Thread Starter
New Member
The API is to talk with the parallel port directly.
The Function ("Inp") is located in the library "inpout32.dll", and i have wrapped it in a class named "InpOut".
This is the API :
Code:
Declare Auto Function InP Lib "inpout32.dll" Alias "Inp32" (ByVal portAddress As Integer) As Integer
Now i want to call the function from a form and pass a parameter "Port address" (integer)
This works !!! but i want to use another function instead of Val()!
Val() converts a string to an integer, but its from the Old Visual basic
I want to use a new function like: Inp(Convert.toInt16("&H0378"))
and this doesnt work !
2 things are infinite! the Universe and human stupidity =-)
-
Apr 3rd, 2004, 02:44 PM
#9
PowerPoster
Hi
"InP(Val("&H0378"))"
Have you tried
InP(&H0378)
I suggest this because the "&" denotes a hex number following.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Apr 4th, 2004, 09:30 AM
#10
Thread Starter
New Member
RESOLVED
Thanks !
Yours works and i have found it with the parse function !
I cant use the "&H" sign
Code:
integer.Parse("0378", Globalization.NumberStyles.AllowHexSpecifier)
2 things are infinite! the Universe and human stupidity =-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|