You are on page 1of 3

Activity 11. Roots of Quad. Eq. txtRoot1.Text = " " x = Val(txtAmountD.

Text)
txtRoot2.Text = " "
Private Sub cmdClear_Click() End If If x > 100 Then
txtRoot1.Text = " " End Sub A = x * 53.1
txtRoot2.Text = " " lblAmountP.Caption = A
txtCoefA.Text = " "
txtCoefB.Text = " " ElseIf x < 100 Then
txtCoefC.Text = " " B = x * 52.5
txtNoRoots.Text = " " lblAmountP.Caption = B
End Sub
Else: x = 100
Private Sub cmdExit_Click() C = x * 53.1
Activity11.Hide lblAmountP.Caption = C
frmMenu.Show
End Sub End If
End Sub
Private Sub cmdSolve_Click()
Dim A, B, C, Roots As Double
A = Val(txtCoefA.Text)
B = Val(txtCoefB.Text)
C = Val(txtCoefC.Text)
disc = (B ^ 2) - (4 * A * C)
If disc > 0 Then Activity 12. Money Exchange
txtNoRoots.Text = " 2 "
root1 = (-B + Sqr(disc)) / (2 * A) Private Sub cmdClear_Click()
root2 = (-B - Sqr(disc)) / (2 * A) txtAmountD.Text = " "
txtRoot1.Text = Round(root1, lblAmountP.Caption = " "
2)
txtRoot2.Text = Round(root2,
End Sub
2)

Private Sub cmdExit_Click()


ElseIf disc = 0 Then
Activity12.Hide
root1 = (-B ^ 2) / (2 * A)
frmMenu.Show
txtNoRoots.Text = "1"
End Sub
txtRoot1 = Round(root1, 2)

Private Sub cmdProcess_Click()


Else
Dim x, A, B, C As Double
txtNoRoots.Text = "No Roots"
End Sub Times = Val(txtnum.Text)
Do While Times > 0
Num = InputBox("Enter
Number", 0)
Sum = Sum + Num
Times = Times - 1
Loop
lblSum.Caption = "The Sum
of the Numbers is " & Sum
Activity 13.Number of Digits
End Sub

Private Sub cmdClear_Click()


Private Sub cmdExit_Click()
txtInput.Text = " "
End
lblDisplay.Caption = " "
End Sub
End Sub

Private Sub cmdEnter_Click()


Dim x As Integer
x = Val(txtInput.Text)

If x > 0 And x < 10 Then


lblDisplay.Caption = "Your
number has 1 digit."
If x > 9 And x < 100 Then
lblDisplay.Caption = "Your
number has 2 digits."
If x > 99 And x < 1000 Then
lblDisplay.Caption = " Your
number has 3 digits."
If x > 999 And x < 10000
Then lblDisplay.Caption = "Your
number has 4 digits."
Activity 14. Input Box
If x < 0 Or x > 9999 Then
Summation
lblDisplay.Caption = " ERROR "

Option Explicit
End Sub
Dim Times As Integer
Dim Sum As Integer
Private Sub cmdExit_Click()
Dim Num As Integer
Activity13.Hide
Private Sub cmdEnter_Click()
frmMenu.Show
Sum = 0
txtPW.Text = " " tmrGo.Enabled = True
txtUser.SetFocus End Sub

End If Private Sub tmrGo_Timer()


End Sub
If shpRec.Width < 4000
Then
Private Sub cmdExit_Click()
shpRec.Width =
End
shpRec.Width + 40
End Sub

Else
lblLoad.Caption = "Projects
Loaded Successfully"
tmrGo.Enabled = False

Sample 4. Access frmMenu.Show

Private Sub cmdEnter_Click() End If

'If txtUser.Text = "Jayson Pagal" End Sub


And txtPW.Text = "04/19/2000"
Then
'lblMsg1.Caption = "ACCESS"
'lblMsg2.Caption = "DENIED"

'ElseIf txtUser.Text =
"Jayzn2194" And txtPW.Text =
"Rockstar2194" Then
'lblMsg1.Caption = "ACCESS"
'lblMsg2.Caption = "GRANTED"

If txtUser.Text = "Jayson" And


txtPW.Text = "1234" Then
MsgBox "ACCESS GRANTED",
vbOKOnly, "WELCOME"
End
Else
'MsgBox "ACCESS DENIED", Sample 6. Loading
vbOKOnly, "INVALID ACCESS"
MsgBox "INVALID ",
vbExclamation
Private Sub Form_Load()
txtUser.Text = " "

You might also like