Professional Documents
Culture Documents
net
Visual Studio .net
Microsoft’s Integrated Development Environment
(IDE) for creating running and debugging programs
(called applications) written in variety of programming
languages
Project Name
Path
Sub Main()
Dim lagyu As String
Dim num1 As Integer
Dim num2 As Integer
Console.WriteLine("Enter first number: ")
num1 = Console.ReadLine()
Console.WriteLine("Enter second number: ")
num2 = Console.ReadLine()
If num1 > num2 Then
Console.WriteLine("Number 1 is greater than number 2")
Else
Console.WriteLine("Number 2 is greater than number 3")
End If
End Sub
End Module
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
If else/ elseif / else
If num1 > num2 Then
Console.WriteLine("Number 1 is greater than number 2!")
ElseIf (num2 > num1) Then
Console.WriteLine("Number 1 is greater than number 2!")
Else
Console.WriteLine("Number are equal!")
End If
End Module
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
Do Until/Loop Repetition
Test a condition for falsity for repetition to continue.
Statements in the body of a are executed repeatedly as
long as the loop-continuation test evaluates to false
End Sub
End Module
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
Assignment Operators
+= C=+7 C = c +7
-= C-=7 C=c-7
*= C*=7 C=c*7
/= c/=7 C = c /7
\= c\=7 C=c\7
^= C^=7 C=c^7
&= D &= “llo” D= D & “llo”
Sub Main()
Dim a As Integer
Dim var1 As Integer
Dim sum As Integer
a=1
sum = 0
While a <= 10
Console.WriteLine("Enter Number " & a & ":")
var1 = Console.ReadLine()
a += 1
sum = var1 + sum
End While
Console.WriteLine("The sum is " & sum)
End Sub
End Module
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
For/Next Repetition
Repetition structure handles the details of counter-
controlled repetition.
Sub Main()
Dim counter As Integer
For counter = 1 To 10
Console.WriteLine(counter)
Next
End Sub
End Module
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
Using Dialog to Display Message
On the solution explorer, right click on the reference
and add System.windows.forms
MessageBox.OK
End Module
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
Exit Keyword in a Repetition
Exit Do, Exit While, Exit For statements alter the flow
of control by causing immediate exit from a repetition
structure
End Sub
End Class
End Sub
End Class
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
GUI
Label – An area in which icons or un editable text is
displayed
Textbox – An area in which the user inputs data from the
keyboard. This can also display information
Button – An area that triggers an event when clicked
CheckBox – A component that is either selected on
unselected
picOne.Image =
Image.FromFile("D:\VB.net\LaboratoryExercise\Picture
Swapper\Pictures\Pic2.jpg")
treeStudents.Nodes(0).Nodes(0).Nodes.Add(StudName)
End If
End Sub
End Class
VB .net © COPYRIGHT BY BADBOY INC PRESENTED BY:SIR “JPACS”
Font Properties
New Font(Font,Size,Font Style)