|
-
Jul 11th, 2000, 09:57 AM
#1
Thread Starter
Fanatic Member
(from earlier thread)
___________________________________________________
Private Sub Text2_KeyPress(KeyAscii As Integer)
Dim num As Integer num = Val(Text2.Text)
if KeyAscii = 13 Then
Label1.Caption = num + 5
End If
End Sub
_________________________________
Megatron
________________________________________
'm sorry to disagree, but while it is poor code, the line num = text2.text will work just fine as long as the string is a numeric character or characters.
__________________ Marty
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This is what you said in response to Megatron.
All I want to know is WHY is it poor code? How could you make in "unpoor?"
thanks
-
Jul 11th, 2000, 10:06 AM
#2
I think he means that wroking with Strings and Numbers is poor code.
You can make it unpoor by converting your Strings to numbers before you plan to work with them. As shown above, num = Val(Text1) would be an example of unpoor code.
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
|