You are on page 1of 7

MSGBOX Private Sub cmdOK_Click() If chk1.Value = vbChecked And chk2.Value = vbChecked And chk3.

Value = vbChecked Then MsgBox " You like reading, computer and sports " ElseIf chk1.Value = vbChecked And chk2.Value = vbChecked And chk3.Value = vbUnchecked Then MsgBox " You like reading and computer " ElseIf chk1.Value = vbChecked And chk2.Value = vbUnchecked And chk3.Value = vbUnchecked Then MsgBox " You like reading only " ElseIf chk1.Value = vbChecked And chk2.Value = vbUnchecked And chk3.Value = vbChecked Then MsgBox " You like reading and sports " ElseIf chk1.Value = vbUnchecked And chk2.Value = vbChecked And chk3.Value = vbChecked Then MsgBox " You like computer and sports " ElseIf chk1.Value = vbUnchecked And chk2.Value = vbChecked And chk3.Value = vbUnchecked Then MsgBox " You like computer only " ElseIf chk1.Value = vbUnchecked And chk2.Value = vbUnchecked And chk3.Value = vbChecked Then MsgBox " You like sports only " Else MsgBox " You have no hobby " End If End Sub

DEPRECIATION Option Explicit Dim P As Double Dim S As Double

FontItalic = True Else txtName.Dim Y As Double Dim D As Double Private Sub cmd1_Click() P = Val(txt1.FontBold = True Else txtName.FontBold = False End If End Sub Private Sub chkItalic_Click() If chkItalic.FontItalic = False End If End Sub .S) / Y lbl4 = " The depreciation is " & D End Sub CHECKBOX AND OPTION Private Sub Chkbold_Click() If chkBold.Text) S = Val(txt2.Value = 1 Then txtName.Value = 1 Then txtName.Text) Y = Val(txt3.Text) D = (P .

FontUnderline = False End If End Sub Private Sub cmdclear_Click() chkBold = " " chkItalic = " " chkUnderline = " " optRed = " " optBlue = " " optGreen = " " txtName = " " End Sub Private Sub cmdexit_Click() End End Sub Private Sub optBlue_Click() txtName.Private Sub chkUnderline_Click() If chkUnderline.Value = 1 Then txtName.FontUnderline = True Else txtName.ForeColor = vbBlue .

ForeColor = vbRed End Sub PROBLEM Option Explicit Dim l As Double Dim p As Double Dim w As Double Dim momchk1 As Double Dim momchk2 As Double Private Sub cmd1_Click() l = Val(txt1.ForeColor = vbGreen End Sub Private Sub optRed_Click() txtName.Text) momchk1 = p * l / 4 momchk2 = w * l ^ 2 / 8 If chk1.Text) p = Val(txt2.Text) w = Val(txt3.Value = vbChecked And chk2.Value = vbUnchecked Then txt4 = momchk1 .End Sub Private Sub optGreen_Click() txtName.

Value = True Then fee = 750 ElseIf opt3.Value = vbUnchecked And chk2.Value = True Then fee = 500 ElseIf opt2.Text & vbCrLf _ & " SSS Number: " & txt2.Value = vbChecked Then txt4 = momchk2 ElseIf chk1.Text & vbCrLf _ .Text & txt1.ElseIf chk1.Value = vbUnchecked And chk2.Value = vbUnchecked Then txt4 = 0 Else txt4 = momchk1 + momchk2 End If End Sub Benefit Calculator Option Explicit Dim fee As Single Private Sub cmdOK_Click() fee = 0 If opt1.Value = True Then fee = 1000 End If MsgBox " Name: " & Combo1.

Font = "Goudy Old Style" End With lbltitle.FontBold = True lbltitle.ForeColor = vbBlue lblSSS. vbOKOnly.FontBold = True lblname.ForeColor = vbBlue lblname.FontSize = 16 .Alignment = 2 .FontBold = True .ForeColor = vbBlue lblPostcode.& " Post Code: " & txt3.Caption = "Benefit Calculator" .FontBold = True lblSSS.ForeColor = vbBlue .Text & vbCrLf _ & " Benefit Fee Php: " & fee. "Benefit Calculator" End Sub Private Sub Form_Load() With lbl1 .FontBold = True lblPostcode.

". ".FontSize = 10 With Combo1 . ".AddItem " Ms. 4 .AddItem " Mr. ".FontBold = True Frame1.".Frame1. 5 End With End Sub .AddItem " Atty.AddItem " Engr.ForeColor = vbBlue Frame1.AddItem " Dr.Text = " Please Enter Title " .AddItem " Mrs. 1 . 2 . ". 3 . 0 .