Vb file

7,290 views
7,066 views

Published on

Published in: Technology, Design
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,290
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
669
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Vb file

  1. 1. CODINGPrivate Sub Command1_Click()Frame1.Visible = TrueText7.Text = Text1.TextText8.Text = Text2.TextText9.Text = Text3.TextText10.Text = Text4.TextText11.Text = Text5.TextText12.Text = Text6.TextEnd SubPrivate 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 SubPrivate Sub Command3_Click()EndEnd SubPrivate Sub text6_change()Text1.Text = (Text7.Text)End Sub
  2. 2. CODINGPrivate Sub Check1_Click()If Check1.Enabled = True Thenframe3.Visible = TrueEnd IfEnd SubPrivate Sub Command1_Click()MsgBox ("successfully registered")End SubPrivate 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 SubPrivate Sub Option7_Click()If Option7.Value = True ThenFrame1.Visible = FalseFrame2.Visible = TrueEnd IfEnd Sub
  3. 3. Dim AMT As IntegerDim TOTALAMT As IntegerPrivate Sub Command1_Click()AMT = PRICE.Text * QUANTITY.TextTOTALAMT = AMT - (0.15 * AMT)AMOUNT.Text = AMTDISCOUNT.Text = TOTALAMTEnd SubPrivate Sub Command2_Click()BOOK_TITLE.Text = ""PRICE.Text = ""QUANTITY.Text = ""AMOUNT.Text = ""DISCOUNT.Text = ""End SubPrivate Sub Command3_Click()EndEnd Sub
  4. 4. Dim reading, a As DoublePrivate Sub Command1_Click()reading = Val(Text7.Text) - Val(Text6.Text)a = (Val(Text8.Text) * 15) + (reading * 0.5)Text9.Text = readingText10.Text = aEnd SubPrivate Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""Text7.Text = ""Text8.Text = ""Text9.Text = ""Text10.Text = ""End SubPrivate Sub Command3_Click()EndEnd Sub
  5. 5. 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
  6. 6. Private Sub Command1_Click()If Combo1.Text = "" ThenMsgBox ("enter a valid name")ElseCombo1.AddItem Combo1.TextEnd IfEnd SubPrivate Sub Command2_Click()Combo1.RemoveItem Combo1.ListIndexEnd SubPrivate Sub Command3_Click()MsgBox "all items will be deleted"Combo1.ClearEnd SubPrivate Sub Command4_Click()MsgBox ("you have choosen" & Combo1.Text)End SubPrivate Sub Command5_Click()EndEnd Sub
  7. 7. 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
  8. 8. Private Sub Command1_Click()Label3.Caption = Text1.TextLabel4.Caption = Text2.TextLabel5.Caption = List1.TextLabel6.Caption = combo1.TextEnd SubPrivate Sub Command2_Click()Text1.Text = ""Text2.Text = ""Label3.Caption = ""Label4.Caption = ""
  9. 9. Label5.Caption = ""Label6.Caption = ""End SubPrivate Sub Command3_Click()EndEnd SubPrivate 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. 10. 10.Public Function fib(n As Integer) As IntegerIf n = 1 Thenfib = 0ElseIf n = 2 Thenfib = 1Elsefib = fib(n - 1) + fib(n - 2)End IfEnd Function
  11. 11. Private Sub Command1_Click()Dim n As IntegerDim fibo As Integern = Val(Text1.Text)fibo = fib(n)Text2.Text = fiboEnd SubPrivate Sub Command2_Click()Text1.Text = ""Text2.Text = ""End SubPrivate Sub Command3_Click()EndEnd Sub
  12. 12. 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 + rWendText2.Text = sumText3.Text = revEnd Sub
  13. 13. Private Sub Command3_Click()EndEnd SubPrivate Sub Form_Load()Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub
  14. 14. 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
  15. 15. 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")Elsequotient = a / bremainder = a Mod bText3.Text = quotientEnd IfIf remainder = 0 ThenMsgBox ("there is no reminder")Text4.Text = remainderElseText4.Text = remainderEnd IfEnd SubPrivate Sub Command2_Click()
  16. 16. Text1.Text = ""Text2.Text = ""label5.Caption = ""label6.Caption = ""End SubPrivate Sub Command3_Click()EndEnd Sub
  17. 17. 15. WAP to check whether a given number is prime or not .Private Sub Label2_Click()End SubDim a, b, c As IntegerPrivate Sub Command1_Click()a = Val(Text1.Text)b=0For i = 1 To a Step 1c = a Mod iIf c = 0 Thenb=b+1End IfNext iIf b = 2 ThenMsgBox ("no. is prime")End IfEnd SubPrivate Sub Command2_Click()Text1.Text = ""End SubPrivate Sub Command3_Click()EndEnd Sub
  18. 18. 16.WAP to generate first 10 prime number .Private Sub Command1_Click()Dim i As IntegerDim j As IntegerDim num As IntegerDim cnt As Integeri=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
  19. 19. List1.AddItem j & ") " & numEnd Ifcnt = 0num = num + 1WendEnd SubPrivate Sub Command2_Click()Text1.Text = ""List1.ClearEnd SubPrivate Sub Command3_Click()EndEnd Sub
  20. 20. 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 SubPrivate Sub Command2_Click()Text1.Text = ""End SubPrivate Sub Command3_Click()EndEnd Sub
  21. 21. 18.WAP to swap two numbers by :a)Call by valueb)Call by referencePrivate 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 FunctionPrivate Sub Command2_Click()a = Val(Text1.Text)b = Val(Text2.Text)Call swap(a, b)Label3.Caption = aLabel4.Caption = bEnd Sub
  22. 22. Private Sub Command1_Click()Dim a As IntegerDim b As Integera = Val(Text1.Text)b = Val(Text2.Text)Call swapref(a, b)Label3.Caption = aLabel4.Caption = bEnd SubPrivate Sub Command3_Click()Text1.Text = ""Text2.Text = ""Label3.Caption = ""Label4.Caption = ""End SubPrivate Sub Command4_Click()EndEnd Sub
  23. 23. 21. WAP to check wether the given string is in upper case or lower case and also convertit’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 IfEnd SubPrivate Sub Command2_Click()If Text1.Text = UCase(Text1.Text) ThenText1.Text = LCase(Text1.Text)End IfEnd SubPrivate Sub Command3_Click()Text1.Text = ""End SubPrivate Sub Command4_Click()EndEnd Sub

×