
-----------------------------------
shrim
Mon Dec 03, 2012 5:27 pm

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.

-----------------------------------
Tony
Mon Dec 03, 2012 7:30 pm

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.

-----------------------------------
Panphobia
Mon Dec 03, 2012 7:51 pm

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
Mon Dec 03, 2012 9:27 pm

Re: RE:Why does this happen
-----------------------------------
...when I used vb.net in grade 10...
When i program in VB 2008...

Sounds like you might be comparing different (versions of) languages.
