0% found this document useful (0 votes)
21 views

EXPERIMENT 8

Uploaded by

bhatiaaveen95
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

EXPERIMENT 8

Uploaded by

bhatiaaveen95
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

EXPERIMENT 8

(Performed by Aveen Bhatia)


Exp 8-1:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Button1.Enabled = False
TextBox1.Focus()
Button1.Enabled = True
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (TextBox1.Text = "" And TextBox2.Text = "") Then
MsgBox("Enter username and password")
ElseIf (TextBox1.Text = "") Then
MsgBox("Enter username")
ElseIf (TextBox2.Text = "") Then
MsgBox("Enter password")
ElseIf (TextBox1.Text = "admin" And TextBox2.Text = "pass") Then
MsgBox("Login Successful")
Else
MsgBox("invalid userename or password")
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
MsgBox("exit successfully")
Application.Exit()
End Sub
End Class
Exp 8-2:
Public Class Form1
Dim a As Integer = 1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim button As New System.Windows. Forms. Button
Me. Controls.Add(button)
button. Top = a * 50
button.Left = 100
button. Text = "BUTTON" & Me.a. ToString
button.Font = New Font("Times new Roman", 8)
a=a+ 1
MsgBox("BUTTON IS GENERATED!")
End Sub
End Class
Exp 8-3:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1. Text = "RED" Then
Me.BackColor = Color.Red
ElseIf TextBox1. Text = "ORANGE" Then
Me.BackColor = Color.Orange
ElseIf TextBox1. Text = "GREEN" Then
Me.BackColor = Color.Green
Else
MsgBox("Sorry, This Color is unavailable!")
End If
End Sub
End Class
EXPERIMENT 9
(Performed by Aveen Bhatia)
Public Class Form1
Dim s As String
Dim str As String
Dim job As String
Private Sub RadioButtenl_CheckedChanged(sender As Object, e As EventArgs) HandLes RadioButtenl.CheckedChanged
s = "Owner"
End Sub
Private Sub RadicButton2_CheckedChanged(sender As Cbject, e As EventArgs) Handles RadioButton2.CheckedChanged
S = "Manager"
End Sub
Private Sub TextBexl_TextChanged(sender As Object, e As EventArgs) Handles TextBoxl. TextChanged
str = TextBoxl.Text()
End Sub
Private Sub Buttonl_Click(sender As Object, e As EventArgs) Handles Buttonl.Click
If str = "Somay" And S = "Omner" And job IsNot "" Then
MsgBox(str + ", your are an " + s + " and you are logged in for " + job)
ElseIf str = "Prathar" And s = "Manager" And job Islot "" Then
MsgBox(str + ", your are an ' + 5 + " and you are logged in for " + job)
ElseIf str = " Then
MagBox["Enter name first")
Elself s = ". Then
MogBox("Choose Authority")
Elself job = ". Then
MsgBox("CLick first")
ELSe
MogBox("WRONG USER!")
End If
job = ""
End Sub
MsgBax("WRONG USERI")
End If
Job-
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, @ As EventArgs) Handles CheckBoxl. CheckedChanged
Job 6= "ADDING ITEM"
job & ""
End Sub
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2. CheckedChanged
job &- "UPDTAING ITEM"
Job 6= ""
End Sub
Private Sub CheckBox3_CheckedChanged(sender As Object, @ As EventArgs) Handles CheckBox3.CheckedChanged
job 6= "DELETING ITEM"
Job 6= ""
End Sub
Private Sub CheckBoxy_CheckedChanged(sender As Object, & As EventArgs) Handles CheckBox4.CheckedChanged
job 6- "VIEWING ITEM"
job &= ""
End Sub
End Class

Exp 9-2
EXPERIMENT 10
(Performed by Aveen Bhatia)

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim obj As Object
For Each obj In ListBox1.SelectedItems
MessageBox.Show(obj.ToString, "THANK YOU FOR SELECTING")
Next
MessageBox.Show("YOU HAVE SELECTED SUBJECT IS : " + ListBox1.SelectedItem.ToString())
End Sub
End Class

10.2
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim obj As Object
obj = ComboBox1.SelectedItem.ToString
MessageBox.Show(obj.ToString, "THANK YOU FOR SELECTING")
MessageBox.Show("YOU HAVE SELECTED COLLEGE IS : " + obj.ToString())
End Sub
End Class
10.3

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As String
s = InputBox("ENTER SUBJECT YOU WANT IN THIS SEM:-")
ListBox1.Items.Add(s)
Label3.Text = ListBox1.Items.Count
End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


ComboBox1.SelectedIndexChanged
ListBox1.Items.Clear()
Label3.Text = ""
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


ListBox1.MultiColumn = True
ListBox1.SelectionMode = SelectionMode.MultiExtended
End Sub
End Class

You might also like