Slip 1
Write a Vb.net program to check whether entered string is palindrome or not.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Write a Vb.net program to check whether entered string is palindrome or not.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s1 As String
Dim s2 As String
s1 = InputBox("Enter a
String:")
s2 = StrReverse(s1)
If (s1 = s2) Then
MessageBox.Show("The string is
Palindrome")
Else
MessageBox.Show("The string is
not Palindrome")
End If
End Sub
Slip 2
Write
a Vb.net program for blinking an image.
Private Sub
Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Timer1.Tick
If (PictureBox1.Visible = True) Then
PictureBox1.Visible = False
Else
PictureBox1.Visible = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = False
End Sub
Slip 3
Write
a Vb.Net program to move the Text “Dr D Y Patil College” continuously from Left
to Right.
Private Sub Timer1_Tick (sender As System.Object, e As System.EventArgs)
Handles Timer1.Tick
If Label1.Left > 400 Then
Label1.Left = 10
End If
Label1.Left = Label1.Left + 15
End Sub
Slip 4
Write
a Vb.net program to accept a number from an user through InputBox and display its
multiplication table into the ListBox.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim m, t As
Integer
t = 0
t =
CInt(InputBox("Enter the number"))
For m = 1 To 10
ListBox1.Items.Add(m & "*" & t & "="
& (m * t))
Next
End Sub
Slip 5
Write
a Vb.net program to accept n numbers through InputBox and count the number of Armstrong
and Perfect numbers among them and display their count by using messagebox.
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim n As Integer
Dim s As Integer
s = 0
n = Val(TextBox1.Text)
For i = 1 To n - 1
If n Mod i = 0 Then
s = s + i
End If
Next
If n = s Then
MsgBox("Perfect Number")
ListBox1.Items.Add(TextBox1.Text)
Else
MsgBox("Not Perfect
Number")
End If
Dim a, b, c, d As Integer
b = Val(TextBox1.Text)
a = b
c = 0
While (b > 0)
d = b Mod 10
c = c + (d * d * d)
b = b / 10
End While
If (a = c) Then
MsgBox("Given number is an
Armstrong Number")
ListBox2.Items.Add(TextBox1.Text)
Else
MsgBox("Not
armstrong...!!!")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
MsgBox(ListBox1.Items.Count())
End Sub
End Class
Slip 6
Write
a Vb.net program to add two TextBoxes, two Labels and one button at runtime.
Accept two numbers in textboxes and handle DivideByZeroException.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim x, y, z As Integer
x =
CInt(TextBox1.Text)
y =
CInt(TextBox2.Text)
Try
z = x / y
Catch ex As
Exception
MsgBox("Error:" & ex.Message)
Finally
Label4.Text
= "finally is executed"
TextBox3.Text = z
End Try
End Sub
Slip 7
Write a Vb.net
program to design following screen, accept the details from the user. Clicking
on Submit button Net Salary should be calculated and displayed into the TextBox.
Display the MessageBox informing the Name and Net Salary of employee.
Private
Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles
btn_submit.Click
Dim bs, da, hra, ma, pf, pt, it As
Integer
bs = CInt(txt_basicsal.Text)
da = CInt(txt_da.Text)
hra = CInt(txt_hra.Text)
ma = CInt(txt_ma.Text)
pf = CInt(txt_pf.Text)
pt = CInt(txt_pt.Text)
it = CInt(txt_it.Text)
txt_netsal.Text = bs + da + hra + ma +
pf - pt - it
MsgBox("Hello : " &
TextBox1.Text & " " &
"Your Salary: " & txt_netsal.Text)
End Sub
End
Class
Slip 8
Write a Vb.net program to accept number from user into the TextBox.
Calculate the square root of that number also convert the entered number into
binary number and display result into the Message Box
Public
Class Form1
Private Sub btn_cal_Click(sender As System.Object,
e As System.EventArgs) Handles btn_cal.Click
Dim sqrt1 As Double
Dim str1 As String
Dim num, rm As Integer
num = CInt(TextBox1.Text)
sqrt1 = Math.Sqrt(num)
str1 = Convert.ToString(num, 2).PadLeft(32,
"0"c) '32 bits
MsgBox("Square root: " &
sqrt1 & " " &
"Equivalant Binary no: " & str1)
End Sub
End Class
Slip 9
Design
a Vb.net form to pick a date from DateTimePicker Control and display day, month
and year in separate text boxes.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text =
DateTimePicker1.Value.Day
TextBox2.Text =
DateTimePicker1.Value.Month
TextBox3.Text =
DateTimePicker1.Value.Year
End Sub
Slip 10
Write a Vb.net program to accept a character from keyboard and check whether it
is vowel or not. Also display the case of that character.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim c As String
c = TextBox1.Text
If (c = "A" Or c = "a" Or
c = "E" Or c = "e" Or c = "I" Or c =
"i" Or c = "o" Or c = "O" Or c = "U" Or
c = "u") Then
MessageBox.Show("Given
character is Vowel")
Else
MessageBox.Show("Given
character is Not Vowel")
End If
If
(c = UCase(c)) Then
MessageBox.Show("Given
character is in Uppercase")
Else
MessageBox.Show("Given
character is in lowercase")
End If
End Sub