Discussion Locked

Displaying data in Visual Basic

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I need to display variant type data values on the screen. The label and textbox control objects only allow text. What is the easiest method to display data values? Because I am still learning vb, detailed descriptions and code samples would be most helpful.

3 replies

by michael2

mytextbox.text = CStr(yourvariant)

or
Dim newvariable as String
newvariable = CStr(yourvariant)
Then you can use newvariable anywhere a string is expected. ie.
mytextbox.text = newvariable
mylabel.text = newvariable&" add text to string"All conversion functions explained in on-line help. They are

CBool(expression) Return boolean
CByte(expression)Return Byte
CCur(expression) Return currencey
CDate(expression)Return date
CDbl(expression) Return double
CDec(expression) Return decimal
CInt(expression) Return integer
CLng(expression) Return Long
CSng(expression) Return Single
CVar(expression) Return variant
CStr(expression) Return string

by dksj

Thank you for your help. It turned out to be quite easy. I figured there was a function for conversion but was not sure what it was and unfortunately my vb books dont go into that much detail. Thanks again.

This discussion is closed to new replies.