In computer programming, the String variable is widely used to capture and output data among variables or controls. In Visual Basic, you can use the "ToString" method to output a String value to a String variable. This method is useful when you're using Double data types for mathematical operations and the output needs to be a String. You can also use this method to parse a string before it's displayed to the user.
Launch Microsoft Visual Basic Express, click "New Project..." on the left pane of your screen. Select "Console Application." Click "OK" to create a new console project.
Type the following code to declare a Double and a String variable:
Dim myNumber As Double = 52.2
Dim myString As String
Add the following code to convert the numeric value to its equivalent string representation and output the string using a message box:
myString = myNumber.ToString()
Click the "Debug" menu and click "Start Debugging" to run your program.
- Photo Credit Stockbyte/Stockbyte/Getty Images
How to Use Visual Basic
Visual Basic is a programming language like C++ or Java. Computer programmers use Visual Basic to write Window-based programs. You can use...
How to Convert a String to a Number in Visual Basic
Visual Basic (VB) is a programming language used to create desktop and website applications. One common part of VB programming is converting...