Slip 1
Write a Vb.net program to check whether entered string is palindrome or not.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
Dim r As String
s = TextBox1.Text
r = StrReverse(s)
If s = r Then
MessageBox.Show("Enterd String is Palindrome")
Else
MessageBox.Show("Enterd String is Not Palindrome")
End If
End Sub
End Class
Write a Vb.net program to check whether entered string is palindrome or not.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
Dim r As String
s = TextBox1.Text
r = StrReverse(s)
If s = r Then
MessageBox.Show("Enterd String is Palindrome")
Else
MessageBox.Show("Enterd String is Not Palindrome")
End If
End Sub
End Class
Slip 2
Slip4
Write a Vb.net program to accept a number from an user through InputBox and display its multiplication table into the ListBox.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim n As Integer
Dim i As Integer
n = InputBox("Enter Number to create table")
For i = 1 To 10
ListBox1.Items.Add(i * n)
Next
End Sub
End Class
Write a Vb.net program to accept a number from an user through InputBox and display its multiplication table into the ListBox.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim n As Integer
Dim i As Integer
n = InputBox("Enter Number to create table")
For i = 1 To 10
ListBox1.Items.Add(i * n)
Next
End Sub
End Class
Slip 6
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.
Public Class Form1
Dim t1, t2 As New TextBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Controls.Add(t1)
Controls.Add(t2)
t1.Left = 200
t1.Top = 50
t2.Left = 200
t2.Top = 100
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ans, n1, n2 As Double
n1 = CInt(t1.Text)
n2 = CInt(t2.Text)
Try
ans = n1 \ n2
Catch ex As DivideByZeroException
MessageBox.Show("Divide By Zero Exception Caughted")
Finally
MsgBox(ans)
End Try
End Sub
End Class
Slip7
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.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim netsal As Double
netsal = Val(TextBox2.Text) + Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text) + Val(TextBox8.Text)
TextBox9.Text = netsal
MsgBox("Name : " & TextBox1.Text & vbNewLine & "Net Salary : " & netsal)
End Sub
End Class
Slip8
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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As Integer
Dim sqr As Double
Dim rm As Integer
Dim str1 As String
n = CInt(TextBox1.Text)
sqr = Math.Sqrt(n)
While n
rm = n Mod 2
str1 = str1 & rm
n = n \ 2
End While
MessageBox.Show("Square Roor :" & sqr & " Binary Number : " & str1)
StrReverse(str1)
End Sub
End Class
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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As Integer
Dim sqr As Double
Dim rm As Integer
Dim str1 As String
n = CInt(TextBox1.Text)
sqr = Math.Sqrt(n)
While n
rm = n Mod 2
str1 = str1 & rm
n = n \ 2
End While
MessageBox.Show("Square Roor :" & sqr & " Binary Number : " & str1)
StrReverse(str1)
End Sub
End Class
Slip9
Design a Vb.net form to pick a date from DateTimePicker Control and display day, month and year in separate text boxes
Public Class Form1
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Dim d As DateTime
d = DateTimePicker1.Value
TextBox1.Text = d.Day
TextBox2.Text = d.Month
TextBox3.Text = d.Year
End Sub
End Class
Design a Vb.net form to pick a date from DateTimePicker Control and display day, month and year in separate text boxes
Public Class Form1
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Dim d As DateTime
d = DateTimePicker1.Value
TextBox1.Text = d.Day
TextBox2.Text = d.Month
TextBox3.Text = d.Year
End Sub
End Class
Slip10
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.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ch As Char
ch = TextBox1.Text
Select Case ch
Case "A", "E", "I", "O", "U"
MessageBox.Show(ch + " is Vowel And UpperCase")
Case "a", "e", "i", "o", "u"
MessageBox.Show(ch + " is Vowel And LowerCase")
Case Else
MessageBox.Show(ch + " is Not Vowel")
End Select
End Sub
End Class
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.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ch As Char
ch = TextBox1.Text
Select Case ch
Case "A", "E", "I", "O", "U"
MessageBox.Show(ch + " is Vowel And UpperCase")
Case "a", "e", "i", "o", "u"
MessageBox.Show(ch + " is Vowel And LowerCase")
Case Else
MessageBox.Show(ch + " is Not Vowel")
End Select
End Sub
End Class
Slip11
Write a Vb.net program to accept sentences in text box and count the number of words and display the count in message box.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sentence As String
Dim i As Integer
Dim wc As Integer
sentence = TextBox1.Text
Dim arr() As Char = sentence.ToCharArray
For i = 0 To arr.Length - 1
If arr(i) = " " Then
wc = wc + 1
End If
Next
MsgBox("Total Words : " & wc + 1)
End Sub
End Class
Write a Vb.net program to accept sentences in text box and count the number of words and display the count in message box.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sentence As String
Dim i As Integer
Dim wc As Integer
sentence = TextBox1.Text
Dim arr() As Char = sentence.ToCharArray
For i = 0 To arr.Length - 1
If arr(i) = " " Then
wc = wc + 1
End If
Next
MsgBox("Total Words : " & wc + 1)
End Sub
End Class
Slip13
Write a Vb.net program to design the following form, allow the user to select radio buttons from Gender and Age Panel. After Selection appropriate CheckBox from Right Panel should be selected automatically. Display appropriate message into the MessageBox by clicking on Ok button.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MessageBox.Show("Please Enter Name")
Else
Dim age As String
age = ""
If RadioButton3.Checked Then
age = "Less Than 18. Can't Drive "
ElseIf RadioButton4.Checked Then
age = "Between 18 To 40 . Can Drive"
ElseIf RadioButton5.Checked Then
age = "Above 40. All Right "
End If
MessageBox.Show("Name : " + TextBox1.Text + " Age : " + age)
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked Then
CheckBox2.Checked = True
Else
CheckBox2.Checked = False
End If
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Checked Then
CheckBox1.Checked = True
Else
CheckBox1.Checked = False
End If
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
If RadioButton5.Checked Then
CheckBox3.Checked = True
Else
CheckBox3.Checked = False
End If
End Sub
End Class
Write a Vb.net program to design the following form, allow the user to select radio buttons from Gender and Age Panel. After Selection appropriate CheckBox from Right Panel should be selected automatically. Display appropriate message into the MessageBox by clicking on Ok button.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MessageBox.Show("Please Enter Name")
Else
Dim age As String
age = ""
If RadioButton3.Checked Then
age = "Less Than 18. Can't Drive "
ElseIf RadioButton4.Checked Then
age = "Between 18 To 40 . Can Drive"
ElseIf RadioButton5.Checked Then
age = "Above 40. All Right "
End If
MessageBox.Show("Name : " + TextBox1.Text + " Age : " + age)
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked Then
CheckBox2.Checked = True
Else
CheckBox2.Checked = False
End If
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Checked Then
CheckBox1.Checked = True
Else
CheckBox1.Checked = False
End If
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
If RadioButton5.Checked Then
CheckBox3.Checked = True
Else
CheckBox3.Checked = False
End If
End Sub
End Class
Slip14
Write a Vb.net program to design the following form, select the question number from combo box that question will be displayed into textbox and the options for that question will be displayed on four radio buttons, select option and click on submit button result should be displayed in another textbox.
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem() = "Question 1" Then
RichTextBox1.Text = "What is Capital Of India ?"
RadioButton1.Text = "Delhi"
RadioButton2.Text = "Pune"
RadioButton3.Text = "Mumbai"
RadioButton4.Text = "Chennai"
End If
If ComboBox1.SelectedItem() = "Question 2" Then
RichTextBox1.Text = "What is Capital Of Maharashtra ?"
RadioButton1.Text = "Pune"
RadioButton2.Text = "Nagpur"
RadioButton3.Text = "Mumbai"
RadioButton4.Text = "Nagar"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim correct As String
Dim wrong As String
correct = "Answer is correct"
wrong = "Answer is wrong"
If ComboBox1.SelectedItem() = "Question 1" Then
If RadioButton1.Checked Then
TextBox1.Text = correct
ElseIf RadioButton2.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton3.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton4.Checked Then
TextBox1.Text = wrong
End If
End If
If ComboBox1.SelectedItem() = "Question 2" Then
If RadioButton1.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton2.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton3.Checked Then
TextBox1.Text = correct
ElseIf RadioButton4.Checked Then
TextBox1.Text = wrong
End If
End If
End Sub
End Class
Blogger Comment
Facebook Comment