SlideShare a Scribd company logo
Vb file
CODING
Private Sub Command1_Click()

Frame1.Visible = True
Text7.Text = Text1.Text
Text8.Text = Text2.Text
Text9.Text = Text3.Text
Text10.Text = Text4.Text
Text11.Text = Text5.Text
Text12.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()
End
End Sub
Private Sub text6_change()
Text1.Text = (Text7.Text)
End Sub
Vb file
CODING

Private Sub Check1_Click()
If Check1.Enabled = True Then
frame3.Visible = True
End 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 = False
Check2.Value = False
Check3.Value = False
Check4.Value = False
Check5.Value = False
Check6.Value = False
Check7.Value = False
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Option6_Click()
If Option6.Value = True Then
Frame1.Visible = True
Frame2.Visible = False
End If
End Sub

Private Sub Option7_Click()
If Option7.Value = True Then
Frame1.Visible = False
Frame2.Visible = True
End If

End Sub
Dim AMT As Integer
Dim TOTALAMT As Integer

Private Sub Command1_Click()
AMT = PRICE.Text * QUANTITY.Text
TOTALAMT = AMT - (0.15 * AMT)
AMOUNT.Text = AMT
DISCOUNT.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()
End
End 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 = reading
Text10.Text = a
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 = ""
End Sub

Private Sub Command3_Click()
End
End Sub
Private Sub Command1_Click()
Text5.Text = 900 + (Text2.Text)
Text6.Text = Text5.Text * 0.18
Text7.Text = Text5.Text - Text6.Text
Text8.Text = Text7.Text * 0.3
Text9.Text = Text7.Text * 0.15
Text3.Text = Text7.Text * 0.5
Text4.Text = Text7.Text * 0.05
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox ("enter a valid name")
Else
Combo1.AddItem Combo1.Text
End If
End Sub

Private Sub Command2_Click()
Combo1.RemoveItem Combo1.ListIndex
End Sub

Private Sub Command3_Click()
MsgBox "all items will be deleted"
Combo1.Clear

End Sub
Private Sub Command4_Click()
MsgBox ("you have choosen" & Combo1.Text)
End Sub

Private Sub Command5_Click()
End
End Sub
Private Sub Form_Load()
List1.AddItem "NOIDA"
List1.AddItem "DELHI"
List1.AddItem "GURGAON"
List1.AddItem "GREATER NOIDA"
List1.AddItem "FARIDABAD"
End Sub
Private Sub List1_Click()
If List1.ListIndex = 0 Then
Label4.Caption = "spice cinemas:"
Label5.Caption = "TMK"

ElseIf List1.ListIndex = 1 Then
Label4.Caption = "olsen:"
Label5.Caption = "action replay"

ElseIf List1.ListIndex = 2 Then
Label4.Caption = "TGIP:"
Label5.Caption = "GOLMAAL 3"

ElseIf List1.ListIndex = 3 Then
Label4.Caption = "CSM:"
Label5.Caption = "BREAK KE BAAD"

ElseIf List1.ListIndex = 4 Then
Label4.Caption = "PVR SAKET:"
Label5.Caption = "GUZAARISH"
End If
End Sub
Private Sub Command1_Click()
Label3.Caption = Text1.Text
Label4.Caption = Text2.Text
Label5.Caption = List1.Text
Label6.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()
End
End 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 Then
fib = 0


ElseIf n = 2 Then
fib = 1

Else

fib = fib(n - 1) + fib(n - 2)

End If
End Function
Private Sub Command1_Click()
Dim n As Integer
Dim fibo As Integer
n = 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()
End
End Sub
11.WAP ,using recursive function to calculate Nth Fibonacci Series.




Private Sub Command2_Click()
Dim n, i, sum, r As Double
Dim rev As Double
sum = 0
n = Text1.Text
While n <> 0
r = n Mod 10
rev = (rev * 10) + r
n = n  10
sum = sum + r
Wend

Text2.Text = sum
Text3.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 Integer
Dim p As Integer
Dim i As Integer
Dim result As Integer
result = 1
n = Text1.Text
p = Text2.Text
For i = 1 To p Step 1
result = result * n
Next i
Text3.Text = result
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Form2.Cls
End Sub
Private Sub Command3_Click()
End
End Sub
14.WAP to division of two numbers. Also shows divide by zero error .




Private Sub Command1_Click()

Dim a, b, remainder, quotient As Double
a = Val(Text1.Text)
b = Val(Text2.Text)

If b = 0 Then
MsgBox ("invalid divisor")

Else

quotient = a / b
remainder = a Mod b
Text3.Text = quotient
End If


If remainder = 0 Then
MsgBox ("there is no reminder")
Text4.Text = remainder
Else
Text4.Text = remainder
End If


End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
label5.Caption = ""
label6.Caption = ""

End Sub

Private Sub Command3_Click()
End
End Sub
15. WAP to check whether a given number is prime or not .




Private Sub Label2_Click()
End Sub

Dim a, b, c As Integer
Private Sub Command1_Click()
a = Val(Text1.Text)
b=0
For i = 1 To a Step 1
c = a Mod i

If c = 0 Then
b=b+1
End If

Next i
If b = 2 Then
MsgBox ("no. is prime")

End If

End Sub

Private Sub Command2_Click()
Text1.Text = ""

End Sub
Private Sub Command3_Click()
End
End Sub
16.WAP to generate first 10 prime number .




Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim num As Integer
Dim cnt As Integer

i=0
j=0
cnt = 0
num = Val(Text1.Text)
While j < 10
For i = 1 To num
If num Mod i = 0 Then
cnt = cnt + 1
End If
Next i
If cnt = 2 Then
j=j+1
List1.AddItem j & ") " & num
End If

cnt = 0
num = num + 1
Wend
End Sub

Private Sub Command2_Click()
Text1.Text = ""
List1.Clear
End 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 String
Dim b As String
a = Text1.Text
b = StrReverse(a)
If a = b Then
MsgBox ("That is a palindrome!")
Else
MsgBox ("No, it is not a palindrome!")
End If
End Sub

Private Sub Command2_Click()
Text1.Text = ""
End Sub

Private Sub Command3_Click()
End
End 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 Integer
c=a
a=b
b=c
End Function
Private Function swapref(ByRef a As Integer, ByRef b As Integer) As Integer
c=a
a=b
b=c
End Function


Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Call swap(a, b)

Label3.Caption = a
Label4.Caption = b
End Sub
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer

a = Val(Text1.Text)
b = Val(Text2.Text)
Call swapref(a, b)

Label3.Caption = a
Label4.Caption = b
End Sub

Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Label3.Caption = ""
Label4.Caption = ""
End Sub

Private Sub Command4_Click()
End
End 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 String
STR = Val(Text1.Text)
If Text1.Text = UCase(Text1.Text) Then
MsgBox ("IT IS IN UPPERCASE")
End If
If Text1.Text = LCase(Text1.Text) Then
MsgBox ("IT IS IN LOWER CASE")
End If

End Sub

Private Sub Command2_Click()
If Text1.Text = UCase(Text1.Text) Then
Text1.Text = LCase(Text1.Text)
End If
End Sub

Private Sub Command3_Click()
Text1.Text = ""
End Sub

Private Sub Command4_Click()
End
End Sub
Vb file

More Related Content

PDF
Pooja Sharma , BCA Third Year
PDF
Kajal Gaharwal , BCA Third Year
PDF
Ravi Prakash Yadav , BCA Third Year
PPTX
Reservasi hotel
PPT
PDF
Inventory management
PDF
Rakesh Bijawat , BCA Third Year
PDF
Calculator code
Pooja Sharma , BCA Third Year
Kajal Gaharwal , BCA Third Year
Ravi Prakash Yadav , BCA Third Year
Reservasi hotel
Inventory management
Rakesh Bijawat , BCA Third Year
Calculator code

What's hot (20)

PDF
The Ring programming language version 1.9 book - Part 7 of 210
PDF
Binary Search Program in Visual Basic 2008
DOCX
Lampiran source code
PDF
Linear Search Program in Visual Basic 2008
PPTX
Vp lecture 2 ararat
PDF
Regexes and-performance-testing
KEY
Go &lt;-> Ruby
DOCX
PDF
Bhanu Pratap Singh Shekhawat, BCA Third Year
PDF
Ditec esoft C# project
PDF
Ditec esoft C# project
PDF
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
PDF
Eclipse Banking Day
PPT
Python review2
PPTX
Dialog box in vb6
PDF
Python review2
KEY
EventMachine for RubyFuZa 2012
DOCX
Putting dialog boxes to work
PDF
Steady with ruby
PDF
C++ L08-Classes Part1
The Ring programming language version 1.9 book - Part 7 of 210
Binary Search Program in Visual Basic 2008
Lampiran source code
Linear Search Program in Visual Basic 2008
Vp lecture 2 ararat
Regexes and-performance-testing
Go &lt;-> Ruby
Bhanu Pratap Singh Shekhawat, BCA Third Year
Ditec esoft C# project
Ditec esoft C# project
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Eclipse Banking Day
Python review2
Dialog box in vb6
Python review2
EventMachine for RubyFuZa 2012
Putting dialog boxes to work
Steady with ruby
C++ L08-Classes Part1
Ad

Similar to Vb file (20)

DOCX
Vbreport
PDF
Kirti Kumawat, BCA Third Year
PDF
Reshma Kodwani , BCA Third Year
PDF
Harendra Singh,BCA Third Year
PDF
Sudarshan Joshi , BCA Third Year
PPTX
Updated Visual Basic 6 for beginners.pptx
DOCX
Vbreport program
PDF
Akshay Sharma , BCA Third Year
PDF
Mithlesh Singh Rawat , BCA Third Year
PDF
Gaurav Jatav , BCA Third Year
DOCX
Docimp
PDF
Aplikasi rawat-inap-vbnet
DOCX
Codes
DOCX
Programming
PPTX
Richtextbox
PDF
Vb Project ขั้นเทพ
DOC
Area de un triangulo
DOCX
Calculadora
DOC
Ejemplo En Gamabas
Vbreport
Kirti Kumawat, BCA Third Year
Reshma Kodwani , BCA Third Year
Harendra Singh,BCA Third Year
Sudarshan Joshi , BCA Third Year
Updated Visual Basic 6 for beginners.pptx
Vbreport program
Akshay Sharma , BCA Third Year
Mithlesh Singh Rawat , BCA Third Year
Gaurav Jatav , BCA Third Year
Docimp
Aplikasi rawat-inap-vbnet
Codes
Programming
Richtextbox
Vb Project ขั้นเทพ
Area de un triangulo
Calculadora
Ejemplo En Gamabas
Ad

More from Mukund Trivedi (20)

PPTX
System development life cycle (sdlc)
PPTX
Process of design
PPT
New file and form 2
PPT
File organisation
PPTX
Evaluation
PPTX
Database
PPTX
Case tools
PPTX
Evaluation
PPTX
Dfd final
DOCX
C++ file
PPT
Ff40fnatural resources (1)
PPT
Ff40fnatural resources
PPT
F58fbnatural resources 2 (1)
PPT
F58fbnatural resources 2
PPT
F6dc1 session6 c++
DOC
Ee2fbunit 7
PPT
E212d9a797dbms chapter3 b.sc2 (2)
PPT
E212d9a797dbms chapter3 b.sc2 (1)
PPT
E212d9a797dbms chapter3 b.sc2
System development life cycle (sdlc)
Process of design
New file and form 2
File organisation
Evaluation
Database
Case tools
Evaluation
Dfd final
C++ file
Ff40fnatural resources (1)
Ff40fnatural resources
F58fbnatural resources 2 (1)
F58fbnatural resources 2
F6dc1 session6 c++
Ee2fbunit 7
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
KodekX | Application Modernization Development
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
KodekX | Application Modernization Development
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Dropbox Q2 2025 Financial Results & Investor Presentation
The AUB Centre for AI in Media Proposal.docx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Vb file

  • 2. CODING Private Sub Command1_Click() Frame1.Visible = True Text7.Text = Text1.Text Text8.Text = Text2.Text Text9.Text = Text3.Text Text10.Text = Text4.Text Text11.Text = Text5.Text Text12.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() End End Sub Private Sub text6_change() Text1.Text = (Text7.Text) End Sub
  • 4. CODING Private Sub Check1_Click() If Check1.Enabled = True Then frame3.Visible = True End 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 = False Check2.Value = False Check3.Value = False Check4.Value = False Check5.Value = False Check6.Value = False Check7.Value = False End Sub Private Sub Command3_Click() End End Sub Private Sub Option6_Click() If Option6.Value = True Then Frame1.Visible = True Frame2.Visible = False End If End Sub Private Sub Option7_Click() If Option7.Value = True Then Frame1.Visible = False Frame2.Visible = True End If End Sub
  • 5. Dim AMT As Integer Dim TOTALAMT As Integer Private Sub Command1_Click() AMT = PRICE.Text * QUANTITY.Text TOTALAMT = AMT - (0.15 * AMT) AMOUNT.Text = AMT DISCOUNT.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() End End Sub
  • 6. 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 = reading Text10.Text = a 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 = "" End Sub Private Sub Command3_Click() End End Sub
  • 7. Private Sub Command1_Click() Text5.Text = 900 + (Text2.Text) Text6.Text = Text5.Text * 0.18 Text7.Text = Text5.Text - Text6.Text Text8.Text = Text7.Text * 0.3 Text9.Text = Text7.Text * 0.15 Text3.Text = Text7.Text * 0.5 Text4.Text = Text7.Text * 0.05 End Sub Private Sub Command2_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" End Sub Private Sub Command3_Click() End End Sub
  • 8. Private Sub Command1_Click() If Combo1.Text = "" Then MsgBox ("enter a valid name") Else Combo1.AddItem Combo1.Text End If End Sub Private Sub Command2_Click() Combo1.RemoveItem Combo1.ListIndex End Sub Private Sub Command3_Click() MsgBox "all items will be deleted" Combo1.Clear End Sub Private Sub Command4_Click() MsgBox ("you have choosen" & Combo1.Text) End Sub Private Sub Command5_Click() End End Sub
  • 9. Private Sub Form_Load() List1.AddItem "NOIDA" List1.AddItem "DELHI" List1.AddItem "GURGAON" List1.AddItem "GREATER NOIDA" List1.AddItem "FARIDABAD" End Sub Private Sub List1_Click() If List1.ListIndex = 0 Then Label4.Caption = "spice cinemas:" Label5.Caption = "TMK" ElseIf List1.ListIndex = 1 Then Label4.Caption = "olsen:" Label5.Caption = "action replay" ElseIf List1.ListIndex = 2 Then Label4.Caption = "TGIP:" Label5.Caption = "GOLMAAL 3" ElseIf List1.ListIndex = 3 Then Label4.Caption = "CSM:" Label5.Caption = "BREAK KE BAAD" ElseIf List1.ListIndex = 4 Then Label4.Caption = "PVR SAKET:" Label5.Caption = "GUZAARISH" End If End Sub
  • 10. Private Sub Command1_Click() Label3.Caption = Text1.Text Label4.Caption = Text2.Text Label5.Caption = List1.Text Label6.Caption = combo1.Text End Sub Private Sub Command2_Click() Text1.Text = "" Text2.Text = "" Label3.Caption = "" Label4.Caption = ""
  • 11. Label5.Caption = "" Label6.Caption = "" End Sub Private Sub Command3_Click() End End 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
  • 12. 10. Public Function fib(n As Integer) As Integer If n = 1 Then fib = 0 ElseIf n = 2 Then fib = 1 Else fib = fib(n - 1) + fib(n - 2) End If End Function
  • 13. Private Sub Command1_Click() Dim n As Integer Dim fibo As Integer n = 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() End End Sub
  • 14. 11.WAP ,using recursive function to calculate Nth Fibonacci Series. Private Sub Command2_Click() Dim n, i, sum, r As Double Dim rev As Double sum = 0 n = Text1.Text While n <> 0 r = n Mod 10 rev = (rev * 10) + r n = n 10 sum = sum + r Wend Text2.Text = sum Text3.Text = rev End Sub
  • 15. Private Sub Command3_Click() End End Sub Private Sub Form_Load() Text1.Text = "" Text2.Text = "" Text3.Text = "" End Sub
  • 16. 13.WAP ,using recursive function to calculate GCD of a number . Private Sub Command1_Click() Dim n As Integer Dim p As Integer Dim i As Integer Dim result As Integer result = 1 n = Text1.Text p = Text2.Text For i = 1 To p Step 1 result = result * n Next i Text3.Text = result End Sub Private Sub Command2_Click() Text1.Text = "" Form2.Cls End Sub Private Sub Command3_Click() End End Sub
  • 17. 14.WAP to division of two numbers. Also shows divide by zero error . Private Sub Command1_Click() Dim a, b, remainder, quotient As Double a = Val(Text1.Text) b = Val(Text2.Text) If b = 0 Then MsgBox ("invalid divisor") Else quotient = a / b remainder = a Mod b Text3.Text = quotient End If If remainder = 0 Then MsgBox ("there is no reminder") Text4.Text = remainder Else Text4.Text = remainder End If End Sub Private Sub Command2_Click()
  • 18. Text1.Text = "" Text2.Text = "" label5.Caption = "" label6.Caption = "" End Sub Private Sub Command3_Click() End End Sub
  • 19. 15. WAP to check whether a given number is prime or not . Private Sub Label2_Click() End Sub Dim a, b, c As Integer Private Sub Command1_Click() a = Val(Text1.Text) b=0 For i = 1 To a Step 1 c = a Mod i If c = 0 Then b=b+1 End If Next i If b = 2 Then MsgBox ("no. is prime") End If End Sub Private Sub Command2_Click() Text1.Text = "" End Sub Private Sub Command3_Click() End End Sub
  • 20. 16.WAP to generate first 10 prime number . Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim num As Integer Dim cnt As Integer i=0 j=0 cnt = 0 num = Val(Text1.Text) While j < 10 For i = 1 To num If num Mod i = 0 Then cnt = cnt + 1 End If Next i If cnt = 2 Then j=j+1
  • 21. List1.AddItem j & ") " & num End If cnt = 0 num = num + 1 Wend End Sub Private Sub Command2_Click() Text1.Text = "" List1.Clear End Sub Private Sub Command3_Click() End End Sub
  • 22. 17.WAP to check wether a given string is palindrome or not . Private Sub Command1_Click() Dim a As String Dim b As String a = Text1.Text b = StrReverse(a) If a = b Then MsgBox ("That is a palindrome!") Else MsgBox ("No, it is not a palindrome!") End If End Sub Private Sub Command2_Click() Text1.Text = "" End Sub Private Sub Command3_Click() End End Sub
  • 23. 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 Integer c=a a=b b=c End Function Private Function swapref(ByRef a As Integer, ByRef b As Integer) As Integer c=a a=b b=c End Function Private Sub Command2_Click() a = Val(Text1.Text) b = Val(Text2.Text) Call swap(a, b) Label3.Caption = a Label4.Caption = b End Sub
  • 24. Private Sub Command1_Click() Dim a As Integer Dim b As Integer a = Val(Text1.Text) b = Val(Text2.Text) Call swapref(a, b) Label3.Caption = a Label4.Caption = b End Sub Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" Label3.Caption = "" Label4.Caption = "" End Sub Private Sub Command4_Click() End End Sub
  • 25. 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 String STR = Val(Text1.Text) If Text1.Text = UCase(Text1.Text) Then MsgBox ("IT IS IN UPPERCASE") End If If Text1.Text = LCase(Text1.Text) Then MsgBox ("IT IS IN LOWER CASE") End If End Sub Private Sub Command2_Click() If Text1.Text = UCase(Text1.Text) Then Text1.Text = LCase(Text1.Text) End If End Sub Private Sub Command3_Click() Text1.Text = "" End Sub Private Sub Command4_Click() End End Sub