Upload
mukund-trivedi
View
4.992
Download
4
Tags:
Embed Size (px)
Citation preview
CODINGPrivate Sub Command1_Click()
Frame1.Visible = TrueText7.Text = Text1.TextText8.Text = Text2.TextText9.Text = Text3.TextText10.Text = Text4.TextText11.Text = Text5.TextText12.Text = Text6.Text
End Sub
Private Sub Command2_Click()Text1.Text = " "Text2.Text = " "Text3.Text = " "Text4.Text = " "Text5.Text = " "Text6.Text = " "Text7.Text = " "Text8.Text = " "Text9.Text = " "Text10.Text = " "Text11.Text = " "Text12.Text = " "
End Sub
Private Sub Command3_Click()EndEnd SubPrivate Sub text6_change()Text1.Text = (Text7.Text)End Sub
CODING
Private Sub Check1_Click()If Check1.Enabled = True Thenframe3.Visible = TrueEnd If
End Sub
Private Sub Command1_Click()MsgBox ("successfully registered")End Sub
Private Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""Text7.Text = ""Check1.Value = FalseCheck2.Value = FalseCheck3.Value = FalseCheck4.Value = FalseCheck5.Value = FalseCheck6.Value = FalseCheck7.Value = FalseEnd SubPrivate Sub Command3_Click()EndEnd SubPrivate Sub Option6_Click()If Option6.Value = True ThenFrame1.Visible = TrueFrame2.Visible = FalseEnd IfEnd Sub
Private Sub Option7_Click()If Option7.Value = True ThenFrame1.Visible = FalseFrame2.Visible = TrueEnd If
End Sub
Dim AMT As IntegerDim TOTALAMT As Integer
Private Sub Command1_Click()AMT = PRICE.Text * QUANTITY.TextTOTALAMT = AMT - (0.15 * AMT)AMOUNT.Text = AMTDISCOUNT.Text = TOTALAMT
End Sub
Private Sub Command2_Click()BOOK_TITLE.Text = ""PRICE.Text = ""QUANTITY.Text = ""AMOUNT.Text = ""DISCOUNT.Text = ""End Sub
Private Sub Command3_Click()EndEnd Sub
Dim reading, a As Double
Private Sub Command1_Click()reading = Val(Text7.Text) - Val(Text6.Text)a = (Val(Text8.Text) * 15) + (reading * 0.5)Text9.Text = readingText10.Text = aEnd Sub
Private Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""Text7.Text = ""Text8.Text = ""Text9.Text = ""Text10.Text = ""End Sub
Private Sub Command3_Click()EndEnd Sub
Private Sub Command1_Click()Text5.Text = 900 + (Text2.Text)Text6.Text = Text5.Text * 0.18Text7.Text = Text5.Text - Text6.TextText8.Text = Text7.Text * 0.3Text9.Text = Text7.Text * 0.15Text3.Text = Text7.Text * 0.5Text4.Text = Text7.Text * 0.05End SubPrivate Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""Text7.Text = ""Text8.Text = ""Text9.Text = ""End SubPrivate Sub Command3_Click()EndEnd Sub
Private Sub Command1_Click()If Combo1.Text = "" ThenMsgBox ("enter a valid name")ElseCombo1.AddItem Combo1.TextEnd IfEnd Sub
Private Sub Command2_Click()Combo1.RemoveItem Combo1.ListIndexEnd Sub
Private Sub Command3_Click()MsgBox "all items will be deleted"Combo1.Clear
End SubPrivate Sub Command4_Click()MsgBox ("you have choosen" & Combo1.Text)End Sub
Private Sub Command5_Click()EndEnd Sub
Private Sub Form_Load()List1.AddItem "NOIDA"List1.AddItem "DELHI"List1.AddItem "GURGAON"List1.AddItem "GREATER NOIDA"List1.AddItem "FARIDABAD"End SubPrivate Sub List1_Click()If List1.ListIndex = 0 ThenLabel4.Caption = "spice cinemas:"Label5.Caption = "TMK"
ElseIf List1.ListIndex = 1 ThenLabel4.Caption = "olsen:"Label5.Caption = "action replay"
ElseIf List1.ListIndex = 2 ThenLabel4.Caption = "TGIP:"Label5.Caption = "GOLMAAL 3"
ElseIf List1.ListIndex = 3 ThenLabel4.Caption = "CSM:"Label5.Caption = "BREAK KE BAAD"
ElseIf List1.ListIndex = 4 ThenLabel4.Caption = "PVR SAKET:"Label5.Caption = "GUZAARISH"End IfEnd Sub
Private Sub Command1_Click()Label3.Caption = Text1.TextLabel4.Caption = Text2.TextLabel5.Caption = List1.TextLabel6.Caption = combo1.Text
End Sub
Private Sub Command2_Click()Text1.Text = ""Text2.Text = ""Label3.Caption = ""Label4.Caption = ""
Label5.Caption = ""Label6.Caption = ""
End Sub
Private Sub Command3_Click()EndEnd Sub
Private Sub Form_Load()List1.AddItem "computer"List1.AddItem "business"List1.AddItem "humanities"List1.AddItem "Commerce"List1.AddItem "Medical"List1.AddItem "Engineering"combo1.AddItem "ABC"combo1.AddItem "Amity"
End Sub
10.
Public Function fib(n As Integer) As Integer
If n = 1 Thenfib = 0
ElseIf n = 2 Thenfib = 1
Else
fib = fib(n - 1) + fib(n - 2)
End IfEnd Function
Private Sub Command1_Click()Dim n As IntegerDim fibo As Integern = Val(Text1.Text)fibo = fib(n)Text2.Text = fibo
End Sub
Private Sub Command2_Click()
Text1.Text = ""Text2.Text = ""
End Sub
Private Sub Command3_Click()EndEnd Sub
11.WAP ,using recursive function to calculate Nth Fibonacci Series.
Private Sub Command2_Click()Dim n, i, sum, r As DoubleDim rev As Doublesum = 0n = Text1.TextWhile n <> 0r = n Mod 10rev = (rev * 10) + rn = n \ 10sum = sum + rWend
Text2.Text = sumText3.Text = rev
End Sub
Private Sub Command3_Click()End
End Sub
Private Sub Form_Load()Text1.Text = ""Text2.Text = ""Text3.Text = ""
End Sub
13.WAP ,using recursive function to calculate GCD of a number .
Private Sub Command1_Click()Dim n As IntegerDim p As IntegerDim i As IntegerDim result As Integerresult = 1n = Text1.Textp = Text2.TextFor i = 1 To p Step 1result = result * nNext iText3.Text = resultEnd SubPrivate Sub Command2_Click()Text1.Text = ""Form2.ClsEnd SubPrivate Sub Command3_Click()EndEnd Sub
14.WAP to division of two numbers. Also shows divide by zero error .
Private Sub Command1_Click()
Dim a, b, remainder, quotient As Doublea = Val(Text1.Text)b = Val(Text2.Text)
If b = 0 ThenMsgBox ("invalid divisor")
Else
quotient = a / bremainder = a Mod bText3.Text = quotientEnd If
If remainder = 0 ThenMsgBox ("there is no reminder")Text4.Text = remainderElseText4.Text = remainderEnd If
End Sub
Private Sub Command2_Click()
Text1.Text = ""Text2.Text = ""label5.Caption = ""label6.Caption = ""
End Sub
Private Sub Command3_Click()EndEnd Sub
15. WAP to check whether a given number is prime or not .
Private Sub Label2_Click()End Sub
Dim a, b, c As IntegerPrivate Sub Command1_Click()a = Val(Text1.Text)b = 0For i = 1 To a Step 1c = a Mod i
If c = 0 Thenb = b + 1End If
Next iIf b = 2 ThenMsgBox ("no. is prime")
End If
End Sub
Private Sub Command2_Click()Text1.Text = ""
End SubPrivate Sub Command3_Click()EndEnd Sub
16.WAP to generate first 10 prime number .
Private Sub Command1_Click()Dim i As IntegerDim j As IntegerDim num As IntegerDim cnt As Integer
i = 0j = 0cnt = 0num = Val(Text1.Text)While j < 10For i = 1 To numIf num Mod i = 0 Thencnt = cnt + 1End IfNext iIf cnt = 2 Thenj = j + 1
List1.AddItem j & ") " & numEnd If
cnt = 0num = num + 1WendEnd Sub
Private Sub Command2_Click()Text1.Text = ""List1.ClearEnd Sub
Private Sub Command3_Click()End
End Sub
17.WAP to check wether a given string is palindrome or not .
Private Sub Command1_Click()
Dim a As StringDim b As Stringa = Text1.Textb = StrReverse(a)If a = b ThenMsgBox ("That is a palindrome!")ElseMsgBox ("No, it is not a palindrome!")End IfEnd Sub
Private Sub Command2_Click()Text1.Text = ""End Sub
Private Sub Command3_Click()EndEnd Sub
18.WAP to swap two numbers by :a)Call by value b)Call by reference
Private Function swap(ByVal a As Integer, ByVal b As Integer) As Integerc = aa = bb = cEnd FunctionPrivate Function swapref(ByRef a As Integer, ByRef b As Integer) As Integerc = aa = bb = cEnd Function
Private Sub Command2_Click()a = Val(Text1.Text)b = Val(Text2.Text)Call swap(a, b)
Label3.Caption = aLabel4.Caption = bEnd Sub
Private Sub Command1_Click()Dim a As IntegerDim b As Integer
a = Val(Text1.Text)b = Val(Text2.Text)Call swapref(a, b)
Label3.Caption = aLabel4.Caption = bEnd Sub
Private Sub Command3_Click()Text1.Text = ""Text2.Text = ""Label3.Caption = ""Label4.Caption = ""End Sub
Private Sub Command4_Click()EndEnd Sub
21. WAP to check wether the given string is in upper case or lower case and also convert it’s case .
Private Sub Command1_Click()Dim STR As StringSTR = Val(Text1.Text)If Text1.Text = UCase(Text1.Text) ThenMsgBox ("IT IS IN UPPERCASE")End IfIf Text1.Text = LCase(Text1.Text) ThenMsgBox ("IT IS IN LOWER CASE")End If
End Sub
Private Sub Command2_Click()If Text1.Text = UCase(Text1.Text) ThenText1.Text = LCase(Text1.Text)End IfEnd Sub
Private Sub Command3_Click()Text1.Text = ""End Sub
Private Sub Command4_Click()EndEnd Sub