private sub command1_click() if text1.text = 1

28
Private Sub Command1_Click() If Text1.Text = 1 Then Label2.Caption = "THIS DAY IS SUNDAY" ElseIf Text1.Text = 2 Then Label2.Caption = "THIS DAY IS MONDAY" ElseIf Text1.Text = 3 Then Label2.Caption = "THIS DAY IS TUESDAY" ElseIf Text1.Text = 4 Then Label2.Caption = "THIS DAY IS WEDNESDAY" ElseIf Text1.Text = 5 Then Label2.Caption = "THIS DAY IS THURSDAY"

Upload: akshaymalik

Post on 18-Jun-2015

2.039 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()If Text1.Text = 1 ThenLabel2.Caption = "THIS DAY IS SUNDAY"ElseIf Text1.Text = 2 ThenLabel2.Caption = "THIS DAY IS MONDAY"ElseIf Text1.Text = 3 ThenLabel2.Caption = "THIS DAY IS TUESDAY"ElseIf Text1.Text = 4 ThenLabel2.Caption = "THIS DAY IS WEDNESDAY"ElseIf Text1.Text = 5 ThenLabel2.Caption = "THIS DAY IS THURSDAY"ElseIf Text1.Text = 6 ThenLabel2.Caption = "THIS DAY IS FRIDAY"ElseIf Text1.Text = 7 ThenLabel2.Caption = "THIS DAY IS SATURDAY"

Page 2: Private Sub Command1_Click() if Text1.Text = 1

ElseLabel2.Caption = "THE VALID DAY NUMBERS ARE 1-7 ONLY"End IfEnd Sub

Private Sub Command1_Click()If Text1.Text >= 18 ThenLabel2.Caption = "YOU ARE ELIGIBLE VOTER"End IfIf Text1.Text < 18 ThenLabel2.Caption = "YOU ARE NOT ELIGIBLE FOR VOTING"End IfEnd Sub

Page 3: Private Sub Command1_Click() if Text1.Text = 1

Option ExplicitDim INTTEMP As IntegerDim INTFREEZING As IntegerDim STRFREEZING As StringDim STRNOTFREEZING As String

Private Sub Command1_Click()If INTTEMP > 32 ThenLabel2.Caption = STRNOTFREEZINGElseLabel2.Caption = STRFREEZINGEnd IfEnd Sub

Private Sub Command2_Click()If INTTEMP > 0 ThenLabel2.Caption = STRNOTFREEZINGElse

Page 4: Private Sub Command1_Click() if Text1.Text = 1

Label2.Caption = STRFREEZINGEnd IfEnd Sub

Private Sub Command3_Click()Command3.Caption = (MsgBox("DO YOU REALLY WANT TO EXIT ?", vbYesNo) = vbYes)End Sub

Private Sub Form_Load()STRFREEZING = "THIS TEMPERATURE IS FREEZING"STRNOTFREEZING = "THIS TEMPERATURE IS NOT FREEZING"End Sub

Private Sub Text1_Change()INTTEMP = Val(Text1.Text)End Sub

Page 5: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()ANSWERS = 0correctanswer = 0If (Option1.Value = True) Xor (Option2.Value = True) Xor (Option3.Value =

True) ThenANSWERS = ANSWERS + 1End IfIf (Option4.Value = True) Xor (Option5.Value = True) Xor (Option6.Value =

True) ThenANSWERS = ANSWERS + 1End IfIf (Option7.Value = True) Xor (Option8.Value = True) Xor (Option9.Value =

True) ThenANSWERS = ANSWERS + 1

Page 6: Private Sub Command1_Click() if Text1.Text = 1

End IfIf (Option10.Value = True) Xor (Option11.Value = True) Xor (Option12.Value =

True) ThenANSWERS = ANSWERS + 1End IfIf ANSWERS < 4 ThenMsgBox "ANSWER ALL THE QUESTIONS "Exit SubEnd IfIf Option2.Value = True Thencorrectanswer = correctanswer + 1End IfIf Option5.Value = True Thencorrectanswer = correctanswer + 1End IfIf Option9.Value = True Thencorrectanswer = correctanswer + 1End IfIf Option10.Value = True Thencorrectanswer = correctanswer + 1End IfIf correctanswer = 0 ThenMsgBox "0 OUT OF 4:What a disaster!"End IfIf correctanswer = 1 ThenMsgBox "1 OUT OF 4:You need more study!"End IfIf correctanswer = 2 ThenMsgBox "2 OUT OF 4:You scored 50%"End IfIf correctanswer = 3 ThenMsgBox "3 OUT OF 4:You are almost there!"End IfIf correctanswer = 4 ThenMsgBox "4 OUT OF 4:Wow!You are a genius!"End IfEnd Sub

Private Sub Form_Load()Dim answer As IntegerDim correctanswer As IntegerEnd Sub

Page 7: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()ch = InputBox("enter the character")Select Case Asc(ch)Case Asc("A") To Asc("Z")MsgBox "IT IS AN UPPER CASE CHARACTER"Case Asc("a") To Asc("z")MsgBox "IT IS A LOWER CASE CHARACTER"Case Asc("0") To Asc("9")MsgBox "IT IS A DIGIT"Case ElseMsgBox "IT IS ANY OTHER CHARACTER "End SelectEnd Sub

Page 8: Private Sub Command1_Click() if Text1.Text = 1
Page 9: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()ch = InputBox("enter the character")Select Case Asc(ch)Case Asc("A"), Asc("E"), Asc("I"), Asc("O"), Asc("U")MsgBox "IT IS AN UPPER CASE VOWEL"Case Asc("a"), Asc("e"), Asc("i"), Asc("o"), Asc("u")MsgBox "IT IS A LOWER CASE VOWEL"Case Asc("B") To Asc("Z")MsgBox "IT IS AN UPPER CASE CONSONANT"Case Asc("b") To Asc("z")MsgBox "IT IS LOWER CASE CONSONANT"Case ElseMsgBox "NOT AN ALPHABET"End SelectEnd Sub

Page 10: Private Sub Command1_Click() if Text1.Text = 1
Page 11: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()Dim UNITSORDERED As IntegerDim COST As CurrencyUNITSORDERED = Text1.TextIf Option1.Value = True ThenSelect Case UNITSORDEREDCase 1 To 15COST = UNITSORDERED * 50Case 16 To 20COST = UNITSORDERED * 45Case 21 To 30COST = UNITSORDERED * 40Case 31 To 50COST = UNITSORDERED * 35Case Is > 50COST = UNITSORDERED * 30End SelectElseSelect Case UNITSORDEREDCase 1 To 15COST = UNITSORDERED * 60Case 16 To 20COST = UNITSORDERED * 55

Page 12: Private Sub Command1_Click() if Text1.Text = 1

Case 21 To 30COST = UNITSORDERED * 50Case 31 To 50COST = UNITSORDERED * 45Case Is > 50COST = UNITSORDERED * 40End SelectEnd IfIf Check1.Value = 1 ThenCOST = COST - (COST * 0.1)End IfLabel3.Caption = COSTEnd Sub

Private Sub Command1_Click()NUM = InputBox("ENTER A NUMBER")

Page 13: Private Sub Command1_Click() if Text1.Text = 1

coun = 1Sum = Sum + NUMDo While NUM <> 0NUM = InputBox("ENTER A NUMBER")Sum = Sum + 1coun = coun + 1LoopPrint coun; "NUMBERS ENTERED. AND THEIT SUM IS "; SumEnd Sub

Private Sub Form_Load()Dim NUMBER As IntegerDim EVEN As IntegerDim ODD As IntegerEVEN = 0ODD = ONUMBER = InputBox("ENTER A NUMBER")Do While NUMBER <> 0If (NUMBER Mod 2) = 0 ThenEVEN = EVEN + 1ElseODD = ODD + 1

Page 14: Private Sub Command1_Click() if Text1.Text = 1

End IfNUMBER = InputBox("ENTER A NUMBER")LoopForm1.ShowLabel2.Caption = EVENLabel4.Caption = ODDEnd Sub

Private Sub Command1_Click()STRG = Text1.TextL = Len(STRG)REVERSE = ""For I = 1 To LREVERSE = REVERSE + Mid(STRG, L, 1)L = L - 1Next IIf REVERSE = STRG ThenMsgBox "IT IS A PALLENDRONE"Else

Page 15: Private Sub Command1_Click() if Text1.Text = 1

MsgBox "IT IS NOT"End IfEnd Sub

Page 16: Private Sub Command1_Click() if Text1.Text = 1
Page 17: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()Dim a As IntegerDim b As IntegerDim c As IntegerDim n As IntegerDim i As Integern = Text1.Texta = 1b = 1i = 1Print "THE FABONACCI SERIES IS : "Print aPrint bDo While i <= nc = a + bPrint ca = bb = ci = i + 1LoopEnd Sub

Page 18: Private Sub Command1_Click() if Text1.Text = 1

QUIZ MASTER

Page 19: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()ANSWERS = 0correctanswer = 0If (Option1.Value = True) Xor (Option2.Value = True) Xor (Option3.Value = True) ThenANSWERS = ANSWERS + 1End IfIf (Option4.Value = True) Xor (Option5.Value = True) Xor (Option6.Value = True) ThenANSWERS = ANSWERS + 1End IfIf (Option7.Value = True) Xor (Option8.Value = True) Xor (Option9.Value = True) ThenANSWERS = ANSWERS + 1End IfIf (Option10.Value = True) Xor (Option11.Value = True) Xor (Option12.Value = True) ThenANSWERS = ANSWERS + 1End IfIf ANSWERS < 4 ThenMsgBox "ANSWER ALL THE QUESTIONS "Exit SubEnd IfIf Option2.Value = True Thencorrectanswer = correctanswer + 1End IfIf Option5.Value = True Thencorrectanswer = correctanswer + 1End IfIf Option9.Value = True Thencorrectanswer = correctanswer + 1End IfIf Option10.Value = True Thencorrectanswer = correctanswer + 1End IfIf correctanswer = 0 ThenMsgBox "0 OUT OF 4:What a disaster!"End IfIf correctanswer = 1 ThenMsgBox "1 OUT OF 4:You need more study!"End IfIf correctanswer = 2 ThenMsgBox "2 OUT OF 4:You scored 50%"End IfIf correctanswer = 3 ThenMsgBox "3 OUT OF 4:You are almost there!"End IfIf correctanswer = 4 ThenMsgBox "4 OUT OF 4:Wow!You are a genius!"End IfEnd Sub

Private Sub Form_Load()Dim answer As IntegerDim correctanswer As Integer

Page 20: Private Sub Command1_Click() if Text1.Text = 1

End Sub

TRAFFIC LIGHT

Dim STATE As Integer

Private Sub Command1_Click()STATE = 1Shape2.BackColor = vbRedShape3.BackColor = vbWhiteShape4.BackColor = vbWhiteLabel1.Caption = "STOP"End Sub

Private Sub Timer1_Timer()If STATE = 3 ThenSTATE = 1ElseSTATE = STATE + 1End IfSelect Case STATECase 1Shape2.BackColor = vbRedShape3.BackColor = vbWhiteShape4.BackColor = vbWhiteTimer1.Interval = 4000Label1.Caption = "STOP"Print STATECase 2

Shape2.BackColor = vbWhiteShape3.BackColor = vbYellowShape4.BackColor = vbWhiteTimer1.Interval = 4000Label1.Caption = "GO"Print STATECase 3Shape2.BackColor = vbWhiteShape3.BackColor = vbWhiteShape4.BackColor = vbGreenTimer1.Interval = 4000Label1.Caption = "WAIT"Print STATEEnd SelectEnd Sub

Page 21: Private Sub Command1_Click() if Text1.Text = 1
Page 22: Private Sub Command1_Click() if Text1.Text = 1

Q10.Write a program that asks the user to input marks in five subjects. Calculate the total marks and average. Calculate the grade .Private Sub Command1_Click()A = Val(Text1.Text)B = Val(Text2.Text)C = Val(Text3.Text)D = Val(Text4.Text)E = Val(Text5.Text)Command1.Caption = A + B + C + D + ELabel6.Caption = Str(Command1.Caption)End SubPrivate Sub Command2_Click()Dim A As SingleDim B As SingleDim C As SingleDim D As SingleDim E As SingleA = Val(Text1.Text)B = Val(Text2.Text)C = Val(Text3.Text)D = Val(Text4.Text)E = Val(Text5.Text)Command2.Caption = (A + B + C + D + E) / 5Label7.Caption = Str(Command2.Caption)End Sub

Private Sub Command3_Click()grade = Val(Command2.Caption)If grade <= 90 ThenLabel8.Caption = "A+"End IfIf grade <= 80 ThenLabel8.Caption = "A"End IfIf grade <= 70 ThenLabel8.Caption = "B+"End IfIf grade <= 60 ThenLabel8.Caption = "C"End If

Page 23: Private Sub Command1_Click() if Text1.Text = 1

If grade <= 50 ThenLabel8.Caption = "D"End IfIf grade <= 40 ThenLabel8.Caption = "E"End IfEnd Sub

Private Sub Command1_Click()STRG = Text1.TextL = Len(STRG)REVERSE = ""For I = 1 To LREVERSE = REVERSE + Mid(STRG, L, 1)L = L - 1Next IIf REVERSE = STRG ThenMsgBox "IT IS A PALLENDRONE"ElseMsgBox "IT IS NOT"End IfEnd Sub

Page 24: Private Sub Command1_Click() if Text1.Text = 1

Private Sub Command1_Click()N = Text1.TextFor I = 2 To N - 1If N Mod I = 0 ThenFLAG = TrueExit ForElseFLAG = FalseEnd IfNext IIf FLAG = True ThenMsgBox "IT IS NOT A PRIME NUMBER"ElseMsgBox "IT IS A PRIME NUMBER"End IfEnd Sub

Page 25: Private Sub Command1_Click() if Text1.Text = 1