Private Sub Frame1_Click()
txtradius.Text = Val(txtheight.Text) / 2
Shape1.Height = Val(txtradius.Text)
txtcarea.Text = 3.14 * (Val(txtradius.Text) ^ 2)
txtradius.Enabled = False
txtcarea.Enabled = False
End Sub
Private Sub Frame2_Click()
Shape2.Height = Val(txtlength.Text)
Shape2.Width = Val(txtwidth.Text)
txtrarea.Text = Val(txtlength.Text) * Val(txtwidth.Text)
txtrarea.Enabled = False
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub Form_Load()
Form1.BackColor = vbRed
End Sub
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As
Single)
Form1.BackColor = vbGreen
End Sub
Private Sub Picture1_DragOver(Source As Control, X As Single, Y As
Single,
State As Integer)
Form1.BackColor = vbBlue
End Sub
Private Sub cmdaddlist1_Click()
List1.AddItem (txtadd.Text)
txtadd.Text = " "
txtadd.SetFocus
End Sub
Private Sub cmdaddlist2_Click()
List2.AddItem (txtadd.Text)
txtadd.Text = " "
txtadd.SetFocus
End Sub
Private Sub cmdalllefttoright_Click()
Dim i As Integer
For i = 0 To List1.ListCount
List2.AddItem List1.List(i)
Next i
List1.Clear
End Sub
Private Sub cmdallrighttoleft_Click()
Dim i As Integer
For i = 0 To List2.ListCount
List1.AddItem List2.List(i)
Next i
List2.Clear
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdlefttoright_Click()
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End Sub
Private Sub cmdrighttoleft_Click()
List1.AddItem List2.Text
List2.RemoveItem List2.ListIndex
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdnew_Click()
txtperson.Text = ""
txtbirth.Text = ""
txttelephone.Text = ""
txtperson.SetFocus
MonthView1.Visible = True
End Sub
Private Sub txtperson_KeyPress(KeyAscii As Integer)
If Not ((KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii
<= 122) Or (KeyAscii = 8) Or (KeyAscii = 32)) Then
MsgBox "Only Letters are accepted", vbOKCancel
End If
End Sub
Private Sub txtbirth_Click()
If MonthView1.Value > Date Then
MsgBox "Date not accepted"
txtbirth.Text = ""
Else
txtbirth.Text = MonthView1.Value
MonthView1.Visible = False
End If
End Sub
Private Sub txtbirth_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
MonthView1.Visible = True
End If
End Sub
Private Sub txttelephone_KeyPress(KeyAscii As Integer)
If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Or (KeyAscii =
32)) Then
MsgBox "Only numbers are accepted"
End If
End Sub
Private Sub txttelephone_LostFocus()
If Len(txttelephone.Text) <> 8 Then
MsgBox "Only 8 digits accepted."
txttelephone.SetFocus
End If
End Sub
Private Sub cmdedit_Click()
Adodc1.Recordset.Update
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdnew_Click()
txtstudent.SetFocus
Adodc1.Recordset.AddNew
End Sub
Private Sub cmdsave_Click()
Adodc1.Recordset.Save
End Sub
Private Sub txtstudent_LostFocus()
If txtstudent.Text = " " Then
M = MsgBox("can't leave blank", vbOKOnly)
txtstudent.SetFocus
End If
End Sub
Private Sub txtmaths_LostFocus()
If Val(txtmaths.Text) > 100 Then
M = MsgBox("marks can't be more than 100", vbOKOnly)
txtmaths.Text = " "
txtmaths.SetFocus
End If
End Sub
Private Sub txtchemistry_LostFocus()
If Val(txtchemistry.Text) > 100 Then
M = MsgBox("marks can't be more than 100", vbOKOnly)
txtchemistry.Text = " "
txtchemistry.SetFocus
End If
End Sub
Private Sub txtphysics_LostFocus()
If Val(txtphysics.Text) > 100 Then
M = MsgBox("marks can't be more than 100", vbOKOnly)
txtphysics.Text = " "
txtphysics.SetFocus
End If
End Sub
Public sum As Integer
Private Sub cmdaddnumber_Click()
Dim A As Integer
Dim i As Integer
A=0
i=0
sum = 0
Do While i < 10
A = InputBox("Enter ten numbers to be added", "sum of 10 number")
i=i+1
sum = sum + A
Loop
End Sub
Private Sub cmdclear_Click()
txtaddnumber.Text = " "
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdresult_Click()
txtaddnumber.Text = Val(sum)
End Sub
Private Sub BcBlue_Click()
Shape1.BorderColor = vbBlue
End Sub
Private Sub BcGreen_Click()
Shape1.BorderColor = vbGreen
End Sub
Private Sub BcRed_Click()
Shape1.BorderColor = vbRed
End Sub
Private Sub FcBlue_Click()
Shape1.FillColor = vbBlue
Shape1.FillStyle = 0
End Sub
Private Sub FcGreen_Click()
Shape1.FillColor = vbGreen
Shape1.FillStyle = 0
End Sub
Private Sub FcRed_Click()
Shape1.FillColor = vbRed
Shape1.FillStyle = 0
End Sub
Private Sub MenuBig_Click()
Shape1.Height = 6000
Shape1.Width = 6000
End Sub
Private Sub MenuExit_Click()
End
End Sub
Private Sub MenuMedium_Click()
Shape1.Height = 4000
Shape1.Width = 4000
End Sub
Private Sub MenuSmall_Click()
Shape1.Height = 2000
Shape1.Width = 2000
End Sub
Private Sub MenuThick_Click()
Shape1.BorderWidth = 8
End Sub
Private Sub MenuThin_Click()
Shape1.BorderWidth = 2
End Sub