You are on page 1of 8

NAVDEEP KAUR 111076208322

F.Select case
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim marks As Integer
Dim Division As String
marks = TextBox1.Text
Select Case marks
Case 60
Division = MsgBox("first division")
Case 50
Division = MsgBox("second division")
Case 40
Division = MsgBox("third division")
Case Else
Division = MsgBox("fail")
End Select
End Sub
End Class
NAVDEEP KAUR 111076208322
NAVDEEP KAUR 111076208322
NAVDEEP KAUR 111076208322

G.Between range
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim marks As Integer
Dim Division As String
marks = TextBox1.Text
Select Case marks
Case 60 To 100
Division = MsgBox("first division")
Case 50 To 60
Division = MsgBox("second division")
Case 40 To 50
Division = MsgBox("third division")
Case Else
Division = MsgBox("fail")
End Select
End Sub
End Class
NAVDEEP KAUR 111076208322
NAVDEEP KAUR 111076208322

H.For Loop:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim loopcounter As Integer
For loopcounter = 1 To 6
MsgBox("simple for loop.value of loop count is: " + loopcounter.ToString)
Next

End Sub
NAVDEEP KAUR 111076208322

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim loopcounter As Integer
For loopcounter = 1 To 6
MsgBox("simple for loop.value of loop count is: " + loopcounter.ToString)
Next
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim maxnumber As Integer = 0
Dim TOTALSUM As Integer
Try
maxnumber = CInt(TextBox1.Text)

Catch ex As Exception
MsgBox("Please enter valid maxnumber.error:" + ex.Message)
Return
End Try

If maxnumber > 0 Then


NAVDEEP KAUR 111076208322

For i = 0 To maxnumber
TOTALSUM = TOTALSUM + i

Next
MsgBox("total sum up to max number" + maxnumber.ToString + " is" +
TOTALSUM.ToString)
Else
MsgBox("please enter valid max number")

End If

End Sub
End Class

You might also like