At the risk of sounding dumb:
I need to know how to paint a numeric field on a form or convert a text field that receives a numeric value into a number so I can us it in a math calculation.
VB uses implicit conversions when possible, whereas many languages require explicit casting. To "paint a numeric field on a form", either put it in a text box or label, or use the print statement, which will put the result directly on the form.
Selimsl's response is recommended but not required. You can use a string value directly in a math calculation, and VB will implicitly cast your string. One of the problems: "10" - "5" evaluates to 5, an integer. "10" + "5" evaluates to "105", a string. This is because + is overloaded in vb both as a string concatenation operator and an addition operator. Since VB doesn't have to recast the operands to make sense of the operation, it doesn't.
This is why it's a good idea to do as selimsl suggests.
If you want to avoid implicit casting altogether, use the conversion functions. CStr will convert to a string.
HTH
Bob
If you want to convert the input value to a string
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.