Exercises in Information Management

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

BRONZAL, PRECIOUS JAME J.

BSIT-2A
EXERCISES AND LECTURES IN INFORMATION MANAGEMENT

EXERCISE 1:

SOURCE CODE:
Public Class Exercise1

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


System.EventArgs) Handles btnClose.Click
Close()
End Sub

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


System.EventArgs) Handles btnClear.Click
TextBox1.Clear()
End Sub

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


System.EventArgs) Handles btnClickMe.Click
Dim choice As Char

choice = LCase(TextBox1.Text)
Select Case choice

Case "r"
Label2.Text = "Red"

Case "b"
Label2.Text = "Blue"

Case "y"
Label2.Text = "Yellow"

Case "g"
Label2.Text = "SENIOR"

Case Else
Label2.Text = "OUT OF RANGE"

End Select
End Sub
End Class

EXERCISE 2:

SOURCE CODE:
Public Class Exercise2

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


System.EventArgs) Handles btnClose.Click
Close()
End Sub

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


System.EventArgs) Handles btnClear.Click
TextBox1.Clear()
End Sub

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


System.EventArgs) Handles btnClickMe.Click
If TextBox1.Text = "Password" Then
MessageBox.Show("Access Granted!", "Password", MessageBoxButtons.OK,
MessageBoxIcon.Information)
Else
MessageBox.Show("Access Denied!", "Password", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
End Sub

End Class

EXERCISE 3:

SOURCE CODE:
Public Class Exercise2

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


System.EventArgs) Handles btnClose.Click
Close()
End Sub

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


System.EventArgs) Handles btnClear.Click
TextBox1.Clear()
End Sub

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


System.EventArgs) Handles btnClickMe.Click
If TextBox1.Text = "Password" Then
MessageBox.Show("Access Granted!", "Password", MessageBoxButtons.OK,
MessageBoxIcon.Information)

Else
MessageBox.Show("Access Denied!", "Password", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
End Sub

End Class
EXERCISE 4:

SOURCE CODE:
Public Class Exercise4

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


Handles Button1.Click
Dim num1 As Integer = 1
Do Until num1 = 10
ListBox1.Text = ListBox1.Items.Add(num1)
num1 += 1
Loop
End Sub
End Class

EXERCISE 5:
SOURCE CODE:
Public Class Exercise5

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


Handles Button1.Click
Dim num1 As Integer = 2
Do Until num1 = 12
ListBox1.Text = ListBox1.Items.Add(num1)
num1 += 2
Loop
End Sub
End Class

EXERCISE 6:

SOURCE CODE:
Public Class Exercise6

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


Handles Button1.Click
Dim num1 As Integer = 12
Do Until num1 = 0
ListBox1.Text = ListBox1.Items.Add(num1)
num1 -= 2
Loop
End Sub
End Class
EXERCISE 7:

SOURCE CODE:
Public Class Exercise7

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


Handles Button1.Click
Dim sum, n As Integer
ListBox1.Items.Add("Number" & vbTab & " Sum")
ListBox1.Items.Add("=====================")
Do

n += 1

sum += n
ListBox1.Items.Add(n & vbTab & vbTab & sum)
If n = 10 Then
Exit Do

End If
Loop
End Sub
End Class
EXERCISE 8:

SOURCE CODE:
Public Class Exercise8

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


Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text & vbTab & vbTab + TextBox2.Text & vbTab & vbTab
+ TextBox3.Text & vbTab & vbTab & TextBox4.Text)
End Sub

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


Handles Button2.Click
ListBox1.Items.Remove(TextBox1.Text & vbTab & vbTab + TextBox2.Text & vbTab &
vbTab + TextBox3.Text & vbTab & vbTab & TextBox4.Text)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Close()
End Sub
End Class

You might also like