|
-
Nov 22nd, 1999, 01:30 AM
#1
Thread Starter
New Member
Hello,
I have a little problem with conversion a string variable to double one.
Here is the code:
Private Sub Form_Click()
Dim a As Double
Dim b As Double
Dim c As Double
Dim d As String
a=2
b=3
d = Text1.Text
'Text1.Text="a+b"
'I type this when running the form
c = Val(d)
MsgBox c
'I want to get result 5, but it displays 0. 'What's wrong ???
End Sub
Please, help me to get rid of this !!!
-
Nov 22nd, 1999, 03:07 AM
#2
Junior Member
Private Sub Form_Click()
Dim a As Double
Dim b As Double
Dim c As Double
Dim d As String
a=2
b=3
d = Text1.Text
_____________________________________
' Cannot type name of variables in to textbox
' on form --- After this the string 'd' holds
' the value 'a+b' as a string, when the val
' function executes --- there is no valid ' integer in the variable so it returns 0.
' ' try typing '5' into your textbox...
__________________________________________
'Text1.Text="a+b"
'I type this when running the form
c = Val(d)
MsgBox c
'I want to get result 5, but it displays 0. 'What's wrong ???
End Sub
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
|