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
This tutorial is about some basic concepts in Computer Science and programming with Visual Basic and C++.
Monday, March 23, 2009
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
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
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
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
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
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
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
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
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
* * * * *
* * * *
* * *
* *
*
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
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
*
* *
* * *
* * * *
* * * * *
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
Next i
End Sub
Subscribe to:
Posts (Atom)