Q17.
Create an application to register employee called training program show the details in
another form by using windows form.
Ans :
Submit :
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim OBJ As New Form3
OBJ.STRINGPASS1 = TextBox1.Text
OBJ.STRINGPASS2 = TextBox2.Text
OBJ.STRINGPASS3 = TextBox3.Text
OBJ.STRINGPASS4 = TextBox4.Text
OBJ.STRINGPASS5 = TextBox5.Text
OBJ.STRINGPASS6 = TextBox6.Text
OBJ.Show()
Me.Hide()
End Sub
Output :
Form 3
Q23.
Create an application to change the background color of a form by use of radio button
and forecolor of radio button
Ans :
Coding :
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter
Me.Text = "Change Color"
End Sub
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton1.CheckedChanged
Me.BackColor = Color.Red
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton2.CheckedChanged
Me.BackColor = Color.Blue
End Sub
Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton3.CheckedChanged
Me.BackColor = Color.Green
End Sub
Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton4.CheckedChanged
Me.ForeColor = Color.White
End Sub
Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton5.CheckedChanged
Me.ForeColor = Color.Black
End Sub
Private Sub RadioButton6_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton6.CheckedChanged
Me.ForeColor = Color.Yellow
End Sub
End Class
Output :
Q24.
Create an application to add icons in combo box form list box.
Ans :
Coding :
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ListBox1 .Items .Add (ComboBox1.Text )
End Sub
End Class
Output :
Q25.
Create an application to add list of items in second combo box by selection of first
combo box.
Ans :
Coding :
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ComboBox2.Items.Add(ComboBox1.Text)
End Sub
End Class
Output :
Q26.
Create an application to implement open dialog and save file dialog.
Ans :
Coding :
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.InitialDirectory = "E:\"
OpenFileDialog1.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*"
OpenFileDialog1.FilterIndex = 2
OpenFileDialog1.RestoreDirectory = True
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
SaveFileDialog1.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*"
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, RichTextBox1.Text, True)
End If
End Sub
End Class
Q28.
Create an application to search student details form the database if found then show all
the details and apply filtration by use of combo box.
Ans :
Coding :
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ComboBox1.SelectedIndexChanged
ComboBox1.Focus()
Table1BindingSource.Filter = String.Format("[STUDENT_ID] Like '{0}%'",
Me.ComboBox1.Text.Trim())
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
End Class
Output :