Public Class Form1
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Dim FirstName As String
Dim Age As Integer
Dim GPA As Decimal
Dim Result As DialogResult
FirstName = "Dalonte"
Age = "22"
GPA = "3.6"
Result = MessageBox.Show(FirstName & Age & GPA)
End Sub
End Class
The Integer data type provides optimal performance on a 32-bit processor. The other integral types are slower to load and store from and to memory.
The Decimal data type provides the greatest number of significant digits for a number. It supports up to 29 significant digits and can represent values in excess of 7.9228 x 10^28. It is particularly suitable for calculations, such as financial, that require a large number of digits but cannot tolerate rounding errors.
The default value of Decimal is 0.
Use the String data type to hold multiple characters without the array management overhead of Char(), an array of Char elements.
The default value of String is Nothing (a null reference). Note that this is not the same as the empty string (value "").
The default value of Integer is 0.
This is how you set a Boolean variable:
Dim runningVB As Boolean
' Check to see if program is running on Visual Basic engine.
If scriptEngine = "VB" Then
runningVB = True
End If
Use the Boolean data type to contain two-state values such as true/false, yes/no, or on/off.
The default value of Boolean is False.
When Visual Basic converts numeric data type values to Boolean, 0 becomes False and all other values become True. When Visual Basic converts Boolean values to numeric types, False becomes 0 and True becomes -1.
This is how to convert a number variable into a string
Dim int As Integer = 789
Dim str As String = int.ToString()
str now holds 789 as a string.
you start by declaring a int, then after you do that you have to declare a string = int.ToString()
so that what ever value you entered for your int will also be = to your string variable.
This is how you convert a int into a decimal
Dim d=132.31223 as Double
This is easy all you have to do is that when you declare your int follow it by as Double
This is how you join two strings
Dim FirstName As String
Dim LastName As String
Dim FullName As String
FirstName = "Bill"
LastName = "Gates"
FullName = FirstName & LastName
Textbox1.Text = FullName
For this one all you have to is declare to string and give them both a value. This declare another variable witch will be use to join them. Once you declare another string to add the other two you have to = is to String1 & String2
Your int to decimal is not right. You converted an int into a double rather than a decimal.
ReplyDelete