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

Program

Uploaded by

canant483
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Program

Uploaded by

canant483
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

LOGIN FORM:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If TextBox1.Text = "psg" And TextBox2.Text = "123" Then
MsgBox("login success")
Else
MsgBox("Invalid username or password")

End If
End Sub
End Class

FRUIT BILLING:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If CheckBox1.Checked = True Then
TextBox4.Text = Val(Label6.Text) * Val(TextBox1.Text)
End If
If CheckBox2.Checked = True Then
TextBox5.Text = Val(Label7.Text) * Val(TextBox2.Text)
End If
If CheckBox3.Checked = True Then
TextBox6.Text = Val(Label8.Text) * Val(TextBox3.Text)
End If
TextBox7.Text = Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)

End Sub
End Class
FEEDBACK FORM:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ((RadioButton1.Checked = False) And (RadioButton2.Checked = False) And
(RadioButton3.Checked = False)) Then
MsgBox("choose any option in lecture was structed and well organised")
ElseIf ((RadioButton4.Checked = False) And (RadioButton5.Checked = False) And
(RadioButton6.Checked = False)) Then
MsgBox("choose any option in learning material was accesible")
Else
MsgBox("submitted successfully")

End If
End Sub

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


TextBox1.TextChanged
If TextBox1.Text = " " Then
MsgBox("name must be entered")
TextBox1.Clear()
TextBox1.Focus()
ElseIf Not Regex.IsMatch(TextBox1.Text, "^[a-z A-Z\ S]*$") Then
MsgBox("name should be character only")
TextBox1.Clear()
TextBox1.Focus()

End If
End Sub
End Class

FONT COLOR:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If FontDialog1.ShowDialog = DialogResult.OK Then

End If
TextBox1.ForeColor = FontDialog1.Color
TextBox1.Font = FontDialog1.Font
End Sub

End Class

MOUSE BUTTON:

Public Class Form1

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


Button1.MouseHover
Button1.BackColor = Color.Yellow
End Sub

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


Button1.MouseLeave
Button1.BackColor = Color.Green
End Sub
End Class

LISTBOX:

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ListBox1.Items.Add("Pen")
ListBox1.Items.Add("Pencil")
ListBox1.Items.Add("Eraser")
ListBox1.Items.Add("Ruler")
End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles ListBox1.SelectedIndexChanged
TextBox1.Text = ListBox1.SelectedItem.ToString()
If ListBox1.SelectedItem.ToString() = "Pen" Then
TextBox2.Text = 10
ElseIf ListBox1.SelectedItem.ToString() = "Pencil" Then
TextBox2.Text = 5
ElseIf ListBox1.SelectedItem.ToString() = "Eraser" Then
TextBox2.Text = 5
Else
TextBox2.Text = 15
End If
End Sub
End Class

TIMER QUIZ:

Public Class Form1


Dim score As Integer
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
TextBox1.Text = CStr(CDbl(TextBox1.Text) + 1)
score = 0
If RadioButton2.Checked = True Then
score = score + 1
End If
If TextBox1.Text = 100 Then
Timer1.Stop()
MsgBox("Time is over")
MsgBox("Score is " & score)
Me.Close()
End If
End Sub

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


Timer1.Start()
End Sub
End Class

DRAWING SHAPES :

Public Class Form1


Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
ExitToolStripMenuItem.Click
Me.Close()

End Sub

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


LineToolStripMenuItem.Click
Dim mygraphics As Graphics = PictureBox1.CreateGraphics
Dim mypen As Pen
mypen = New Pen(Brushes.DarkGreen, 20)
mygraphics.DrawLine(mypen, 50, 110, 160, 140)
End Sub

Private Sub CircleToolStripMenuItem_Click(sender As Object, e As EventArgs)


Handles CircleToolStripMenuItem.Click
Dim mygraphics As Graphics = PictureBox1.CreateGraphics
Dim mypen As Pen
mypen = New Pen(Drawing.Color.DarkCyan, 20)
mygraphics.DrawEllipse(mypen, 150, 80, 160, 50)
End Sub

Private Sub RectanglToolStripMenuItem_Click(sender As Object, e As EventArgs)


Handles RectanglToolStripMenuItem.Click
Dim mygraphics As Graphics = PictureBox1.CreateGraphics
Dim mypen As Pen
mypen = New Pen(Drawing.Color.DarkTurquoise, 20)
mygraphics.DrawRectangle(mypen, 300, 150, 100, 100)
End Sub
End Class

CUT,COPY,PASTE :

Public Class Form1


Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles
ToolStripButton1.Click
RichTextBox1.Text = ""
End Sub

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


ToolStripButton2.Click
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.Text =
My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
End If
End Sub

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


ToolStripButton3.Click
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName,
RichTextBox1.Text, False)
End If
End Sub

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


ToolStripButton4.Click
RichTextBox1.Cut()
End Sub

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


ToolStripButton5.Click
RichTextBox1.Copy()
End Sub

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


ToolStripButton6.Click
RichTextBox1.Paste()
End Sub

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


ToolStripButton7.Click
RichTextBox1.SelectAll()
End Sub

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


ToolStripButton8.Click
RichTextBox1.Undo()
End Sub

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


ToolStripButton9.Click
RichTextBox1.Redo()
End Sub
End Class

You might also like