Dim fries As String
Dim DietState As String
fries = TextBox1.Text
Select Case creamcake
Case "Eaten"
DietState = "Diet Ruined"
Case "Not Eaten"
DietState = "Diet Not Ruined"
Case Else
DietState = "Didn't check"
End Select
MsgBox DietState
Monday, January 31, 2011
Case statements
Here is an example of how to effectively write a Case statement. This Code is very useful in a prgram multiple outcomes to a problem.
If statement that makes one decision
In this code i will show an if statement that makes only one decision. This would be helpful when making a program or application that would have to make one or more decisions.
Dim scriptEngine as String
If scriptEngine = "VB" Then
runningVB = True
End If
messageBox.Show(runningVB)
In this code many decisions are made.
Dim intW As Integer = 10
If intW > 11 Then
MessageBox.Show("intX > 11")
ElseIf intW < 5 Then MessageBox.Show("intW < 5")
Else
MessageBox.Show("Fallback code block")
End If
How to convert a number variable into a string
This code describes how to convert a number variable to a string:
- Convert number to string
- CStr
- IntVar.ToString
Dim eggs As Decimal = 62
Dim Charles As Integer = eggs.ToString
MessageBox.Show(Charles)
Wednesday, January 26, 2011
Converting Integers to decimal
In this code I will show how to convert an integer to a decimal.
Converts an decimal to a Integer
Dim milk AS Decimal
Dim Charles as Integer
Eggs = 24
charles =CInt(eggs) or Decimal.ToInt32(eggs)
MessageBox.Show(charles.GetType.ToString)
Join a string to another string, also known as string concatenation.
This code joins two strings and is known as concatenation
Dim FirstName As String
Dim LastName As String
Dim FullName As String
FirstName = “Vincent”
LastName= “Webb”
FullName = FirtName & LastName
MessageBox.Show(FullName)
Dim FirstName As String
Dim LastName As String
Dim FullName As String
FirstName = “Vincent”
LastName= “Webb”
FullName = FirtName & LastName
MessageBox.Show(FullName)
Sunday, January 16, 2011
Bloggers Everywhere
Is there a way to import live wall papers
Friday, January 14, 2011
This is my new Programming 2 blog Welcome. Since i dont know what else to say ....
Subscribe to:
Posts (Atom)