Hi
How to convert string to integer.
For eg Myint = Text1.text dint work out.
regards
viswanathan
Printable View
Hi
How to convert string to integer.
For eg Myint = Text1.text dint work out.
regards
viswanathan
VB Code:
intMyInt = Cint(txtText)
VB Code:
MyInt = Cint(Text1.Text)
.Text is default for a Text box so you don't need to use it in code.
Valid point Glen, but I beleive its good practice - it makesQuote:
Originally posted by GlenW
.Text is default for a Text box so you don't need to use it in code.
you use the, or at least, makes you think about the .property
you need to use.
You're probably right Bruce, guess I'm just lazy.;)Quote:
Originally posted by Bruce Fox
Valid point Glen, but I beleive its good practice - it makes
you use the, or at least, makes you think about the .property
you need to use.
:)
(you and me both ;))
Guess our code didn't work or we'd have been thanked.:rolleyes:
You might also want to use the Val function in order not to get a 13 Type Mismatch if the text box contains 'string' data instead of a number.
NateVB Code:
MyInt = Cint(Val(Text1.Text))
one other point on this... MS got rid of the default properties on controls in VB.NET because it was bad practice... just like they got rid of other bad bad things like variants and negative bounds in arrays.Quote:
Originally posted by Bruce Fox
Valid point Glen, but I beleive its good practice - it makes
you use the, or at least, makes you think about the .property
you need to use.