Thought Sharing

Tuesday, November 23, 2010

List of Programs for Visual Basic Practical

List of Programs for Visual Basic Practical

1. Login page
2. Registration form
3. Calculator
4. Comparison b/w two no, Comparison b/w 3 no
5. Display pattern of counting
6. Display the table of 2.
7. Display the table of any number
8. Pattern of alphabets in serial order and in reverse order (eeeee,dddd,ccc,bb,a)
9. Pattern of alphabets in serial and reverse order (a,ab,abc,abcd,abcde)
10. Pattern of stars (*,**,***,****,*****): in serial and reverse order
11. To check where a number is Prime or Not.
12. Check no is even or odd
13. Check the year is leap year or not
14. Calculate compound interest
15. Calculate simple interest
16. Factorial of a number
17. To check a string is palindrome or not
18. Traffic light signal using Timer control
19. Storing and displaying 10 numbers in an array
20. Sorting 10 numbers stored in an array
21. Fibonacci series
22. Do while, loop while, while wend, Do until, loop until
23. Conversion of Celsius to Fahrenheit and vice versa
24. Swapping 2 numbers
25. Sum and Average of 10 numbers stored in a array
26. Creating an MDI application
27. Database connectivity using DAO
28. Database connectivity using RDO
29. Database connectivity using ADO

Friday, December 11, 2009

Write a Program in VB to sort 10 numbers using an Array

Private Sub Command1_Click()


Dim Number(10) As Integer

Dim i As Long

Dim j As Long

Dim Temp As Integer

For i = 1 To 10

Number(i) = InputBox("Enter any number")

Next
For i = 1 To 10

For j = i To 10

If Number(i) > Number(j) Then

Temp = Number(i)

Number(i) = Number(j)

Number(j) = Temp

End If

Next j

Next i
For i = 1 To 10

Print Number(i)

Next


End Sub

Wednesday, December 9, 2009

Write a program in VB to calculate average of 10 numbers using arrays

Private Sub Command1_Click()
Dim n(10) As Integer
Dim sum As Long
Dim Avg As Single
sum = 0
For i = 1 To 10
n(i) = InputBox("Enter number")
Next
For i = 1 To 10
sum = sum + n(i)
Next
Print sum
Avg = sum / 10
Print Avg
End Sub

Monday, March 23, 2009

Write a program in Visual Basic to check whether a string is Palindrome or not.

Write a program in Visual Basic to check whether a string is Palindrome or not.

A palindrome is any "word" which is the same forward and backward e.g. amma, radar, noon, 20011002 etc

Step-1 Drag & drop one Text box and one Command button on form.
Step-2 Write following code on the click event of command button:

Private Sub Command1_Click()
a = StrReverse(Text1.Text)
If a = Text1.Text Then
MsgBox "Given string is Palindrome"
Else
MsgBox "String is Not Palindrome"
End If
End Sub

Program in Visual Basic to generate the following pattern of alphabets:

Program in Visual Basic to generate the following pattern of alphabets:

E E E E E
D D D D
C C C
B B
A
Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 69 To 65 Step -1
For j = 65 To i
Print Chr(i);
Next j
Print
Next i
End Sub

Program in Visual Basic to generate the following pattern of alphabets:

Program in Visual Basic to generate the following pattern of alphabets:

A
B B
C C C
D D D D
E E E E E

Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 65 To 69 Step 1
For j = 65 To i
Print Chr(i);
Next j
Print
Next i
End Sub

Program in Visual Basic to generate the following pattern of alphabets:

Program in Visual Basic to generate the following pattern of stars:

A B C D E
A B C D
A B C
A B
A

Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 69 To 65 Step -1
For j = 65 To i
Print Chr(j);
Next j
Print
Next i

End Sub

Program in Visual Basic to generate the following pattern of alphabets:

Program in Visual Basic to generate the following pattern of alphabets:
A
A B
A B C
A B C D
A B C D E
Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 65 To 69 Step 1
For j = 65 To i
Print Chr(j);
Next j
Print
Next i

End Sub

Program in Visual Basic to generate the following pattern of stars:

Program in Visual Basic to generate the following pattern of stars:

* * * * *
* * * *
* * *
* *
*

Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 5 To 1 Step -1
For j = 1 To i
Print " * ";
Next j
Print
Next i

End Sub

Program in Visual Basic to generate the following pattern of stars:

Program in Visual Basic to generate the following pattern of stars:

*
* *
* * *
* * * *
* * * * *

Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 1 To 5 Step 1
For j = 1 To i
Print " * ";
Next j
Print
Next i

End Sub