Posted: Mon Dec 03, 2012 5:27 pm Post subject: Why does this happen
When i program in VB 2008 and want to get user input it makes me put CInt infront of the Val()
example:
widthA = CInt(Val(Me.txtBoxWidth.Text))
if i do not put the CInt i get a run time error and when i tell my teacher about this he said it should not be doing that because at my school computer it does not require CInt only on my computer.
Sponsor Sponsor
Tony
Posted: Mon Dec 03, 2012 7:30 pm Post subject: RE:Why does this happen
likely because the input from a textbox is treated as a string (words), and you'd need to explicitly convert it to an integer (numbers) before use.
Posted: Mon Dec 03, 2012 7:51 pm Post subject: RE:Why does this happen
But usually, at least when I used vb.net in grade 10, I never needed to convert it, you would automatically get the text from the textbox and store it in an int var
Tony
Posted: Mon Dec 03, 2012 9:27 pm Post subject: Re: RE:Why does this happen
Panphobia @ Mon Dec 03, 2012 7:51 pm wrote:
...when I used vb.net in grade 10...
shrim @ Mon Dec 03, 2012 5:27 pm wrote:
When i program in VB 2008...
Sounds like you might be comparing different (versions of) languages.