SlideShare a Scribd company logo
1) Display a message in a lable on click event of the button.
Design:-
Public Class Form1
Private Sub btnok_Click(sender As Object, e As EventArgs) Handles btnok.Click
lblshow.Text += "Hello,window!"
End Sub
End Class
Output:-
2) Create a simple VB.Net Project. Place a button on the form and show welcome message on
the click of the button using msgbox() function.
Design:-
Private Sub btnclick_Click(sender As Object, e As EventArgs) Handles btnclick.Click
MessageBox.Show("welcome")
End Sub
End Class
Output:-
3) Accept two numbers using Inputbox on the click of the button and display SUM of these
two numbers using Msgbox.
Design:-
Private Sub btnsumoftwonumber_Click(sender As Object, e As EventArgs) Handles
btnsumoftwonumber.Click
Dim a, b, c As Integer
a = InputBox("Enter First no", "addition")
b = InputBox("Enter Second no", "addition")
c = a + b
MessageBox.Show("ADDITION IS " + Convert.ToString(c), "addition")
End Sub
End Class
Output:-
Docimp
4) Design a form as shown below and perform the operations on the numbers entered.
ResultTexbox mustbe readonly
Design:-
Public Class Form1
Private Sub btnplus_Click(sender As Object, e As EventArgs) Handles btnplus.Click
Dim No1 As Integer = Convert.ToInt32(txtno1.Text)
Dim No2 As Integer = Convert.ToInt32(txtno2.Text)
Dim Result As Integer
Result = No1 + No2
txtresult.Text = Result
End Sub
Private Sub btnminus_Click(sender As Object, e As EventArgs) Handles btnminus.Click
Dim No1 As Integer = Convert.ToInt32(txtno1.Text)
Dim No2 As Integer = Convert.ToInt32(txtno2.Text)
Dim Result As Integer
Result = No1 - No2
txtresult.Text = Result
End Sub
Private Sub btnmulti_Click(sender As Object, e As EventArgs) Handles btnmulti.Click
Dim No1 As Integer = Convert.ToInt32(txtno1.Text)
Dim No2 As Integer = Convert.ToInt32(txtno2.Text)
Dim Result As Integer
Result = No1 * No2
txtresult.Text = Result
End Sub
Private Sub btndiv_Click(sender As Object, e As EventArgs) Handles btndiv.Click
Dim No1 As Integer = Convert.ToInt32(txtno1.Text)
Dim No2 As Integer = Convert.ToInt32(txtno2.Text)
Dim Result As Integer
Result = No1 / No2
txtresult.Text = Result
End Sub
End Class
Output:-
5) Write a program to find weather the given no is Positive, negative or zero.
Design:-
Private Sub btnclick_Click(sender As Object, e As EventArgs) Handles btnclick.Click
Dim no As Integer = Convert.ToInt32(txtnum.Text)
If no > 0 Then
MessageBox.Show("Positive")
txtnum.Clear()
ElseIf no < 0 Then
MessageBox.Show("Negative")
txtnum.Clear()
Else
MessageBox.Show("Zero")
txtnum.Clear()
End If
End Sub
End Class
Output:-
6) Write a program to find the maximum and minimum of given three numbers.
Design:-
Private Sub btnmin_Click(sender As Object, e As EventArgs) Handles btnmin.Click
Dim no1 As Integer = Convert.ToInt32(txtno1.Text)
Dim no2 As Integer = Convert.ToInt32(txtno2.Text)
Dim no3 As Integer = Convert.ToInt32(txtno3.Text)
If no1 < no2 And no1 < no3 Then
MessageBox.Show(no1.ToString + " is minimum")
ElseIf no2 < no1 And no2 < no3 Then
MessageBox.Show(no2.ToString + " is minimum")
ElseIf no3 < no1 And no3 < no2 Then
MessageBox.Show(no3.ToString + " is minimum")
End If
End Sub
Private Sub btnmax_Click(sender As Object, e As EventArgs) Handles btnmax.Click
Dim no1 As Integer = Convert.ToInt32(txtno2.Text)
Dim no2 As Integer = Convert.ToInt32(txtno2.Text)
Dim no3 As Integer = Convert.ToInt32(txtno3.Text)
Dim no1 As Integer = Convert.ToInt32(txtno2.Text)
Dim no2 As Integer = Convert.ToInt32(txtno2.Text)
Dim no3 As Integer = Convert.ToInt32(txtno3.Text)
If no1 > no2 And no1 > no3 Then
MessageBox.Show(no1.ToString + " is maximum")
ElseIf no2 > no1 And no2 > no3 Then
MessageBox.Show(no2.ToString + " is maximum")
ElseIf no3 > no1 And no3 > no2 Then
MessageBox.Show(no3.ToString + " is maximum")
End If
End Sub
End Class
Output:-
7) Develop VB.NET application which calculates the simple interest = p*r*n / 100 and
compound interest = p*(1+r/100)^n using textbox. In the same application take another form
which calculates area and circumference of circle by declaring Pi as constant in module
Design:-
Private Sub btnsimple_Click(sender As Object, e As EventArgs) Handles btnsimple.Click
Dim p As Integer = txtprincipal.Text
Dim r As Integer = txtrate.Text
Dim t As Integer = txttax.Text
Dim ans As Integer
ans = p * r * t / 100
MessageBox.Show(ans)
End Sub
Private Sub btncompound_Click(sender As Object, e As EventArgs) Handles
btncompound.Click
Dim p As Integer = txtprincipal.Text
Dim r As Integer = txtrate.Text
Dim t As Integer = txttax.Text
Dim ans As Integer
ans = p * (1 + r / 100) ^ t - p
MessageBox.Show(ans)
End Sub
Private Sub btncircleradius_Click(sender As Object, e As EventArgs) Handles
btncircleradius.Click
Dim pi As Double = 3.14
Dim r As Integer = txtradius.Text
Dim area As Double
area = pi * r * r
MessageBox.Show(area)
End Sub
End Class
Output:-
Docimp
8) Design a VB form as shown below to read the student data and generate the mark-sheet
data. Clear the data when user clicks the “Clear” button. When user click on “Exit” then end
the execution.
Design:-
Private Sub btngeneral_Click(sender As Object, e As EventArgs) Handles btngeneral.Click
Dim sub1, sub2, sub3, sub4, sub5, sub6, total, per As Double
sub1 = txtsub1.Text
sub2 = txtsub2.Text
sub3 = txtsub3.Text
sub4 = txtsub4.Text
sub5 = txtsub5.Text
sub6 = txtsub6.Text
total = sub1 + sub2 + sub3 + sub4 + sub5 + sub6
txttotal.Text() = total.ToString()
per = total / 6
txtper.Text() = per.ToString()
Dim grade As String
If per >= 90 And per >= 100 Then
txtgrade.Text = "A+"
ElseIf per >= 80 And per <= 89 Then
txtgrade.Text = "A"
ElseIf per >= 70 And per <= 79 Then
txtgrade.Text = "B+"
ElseIf per >= 60 And per <= 69 Then
txtgrade.Text = "B"
ElseIf per >= 50 And per <= 59 Then
txtgrade.Text = "C"
ElseIf per >= 40 And per <= 49 Then
txtgrade.Text = "C+"
Else
txtgrade.Text = "fail"
If txtgrade.Text = "per <=49" Then
txtgrade.Text = "fail"
txtgrade.Enabled = False
Else
txtgrade.Enabled = True
MessageBox.Show("fail")
End If
End If
End Sub
Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click
txtname.Clear()
txtrollno.Clear()
txtsub1.Clear()
txtsub2.Clear()
txtsub3.Clear()
txtsub4.Clear()
txtsub5.Clear()
txtsub6.Clear()
txtgrade.Clear()
txtper.Clear()
txttotal.Clear()
End Sub
End Class
Output:-
9) Design the digital watch using Timer Control.
Design:-
Private Sub TimerTime_Tick(sender As Object, e As EventArgs) Handles TimerTime.Tick
lblhour.Text = Now.Hour
lblmin.Text = Now.Minute
lblsecond.Text = Now.Second
End Sub
Private Sub btnstart_Click(sender As Object, e As EventArgs) Handles btnstart.Click
TimerTime.Start()
End Sub
Private Sub btnstop_Click(sender As Object, e As EventArgs) Handles btnstop.Click
TimerTime.Stop()
End Sub
End Class
Output:-
10) Design the following form.
From the given combo boxes user has to select Starting value and ending value. When
user clicks on “Prime nos” radio button then the prime nos. between the given ranges is
displayed in the list box. Same as for other options.
Design:-
Private Sub rbevenno_CheckedChanged(sender As Object, e As EventArgs) Handles
rbevenno.CheckedChanged
lbdisplay.Items.Clear()
Dim no, no1 As Integer
no = cbstart.Text
no1 = cbend.Text
For item = no To no1 Step 1
If item Mod 2 = 0 Then
lbdisplay.Items.Add(item)
End If
Next
End Sub
Private Sub rbprimeno_CheckedChanged(sender As Object, e As EventArgs) Handles
rbprimeno.CheckedChanged
Dim no, no1, i, f As Integer
f = 0
no = cbstart.Text
no1 = cbend.Text
For item = no To no1
For i = 2 To item - 1
If item Mod i = 0 Then
f = 1
Exit For
Else
f = 0
End If
Next
If f = 0 Then
lbdisplay.Items.Add(item)
End If
Next
End Sub
Private Sub rboddno_CheckedChanged(sender As Object, e As EventArgs) Handles
rboddno.CheckedChanged
lbdisplay.Items.Clear()
Dim no, no1 As Integer
no = cbstart.Text
no1 = cbend.Text
For item = no To no1 Step 1
If item Mod 2 <> 0 Then
lbdisplay.Items.Add(item)
End If
Next
End Sub
End Class
Output:-
Docimp
Docimp
11) Develop following form. When user clicks on Submit button then all information will be
printed in following textbox. When user clicks on Clear then all textboxes will clear. When user
clicks on Exit button then application will be closed.
Design:-
Private Sub btnsubmit_Click(sender As Object, e As EventArgs) Handles btnsubmit.Click
Dim l, f, a, rd As String
Dim gender, hobbies As String
gender = hobbies = ""
f = txtname.Text
l = txtlastname.Text
a = txtaddress.Text
If rbmarried.Checked = True Then
rd = "Married"
ElseIf rbunmarried.Checked = True Then
rd = "UnMarried"
End If
If rbmale.Checked = True Then
gender = "Male"
ElseIf rbfemale.Checked = True Then
gender = "Female"
End If
If cbread.Checked = True Then
hobbies += "Read"
End If
If cbwrite.Checked = True Then
hobbies += "Write"
End If
If cbspeak.Checked = True Then
hobbies += "Speak"
End If
Dim selecteddate As Date
selecteddate = dtpdateofbirth.Value
Dim year As Integer = selecteddate.Year
Dim month As Integer = selecteddate.Month
Dim day As Integer = selecteddate.Day
txtshow.Text = "First Name :" + f + " " + "Last Name :" + l + vbNewLine
txtshow.Text += "Address : " + a + vbNewLine
txtshow.Text += "Marital Status : " + rd + vbNewLine
txtshow.Text += "Gender : " + gender + vbNewLine
txtshow.Text += "EnglishAbility : " + hobbies + vbNewLine
txtshow.Text += "Date Of Birth : " + day.ToString() + "/" + month.ToString() +
"/" + year.ToString() + vbNewLine
End Sub
Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click
txtname.Clear()
txtlastname.Clear()
txtaddress.Clear()
End Sub
Private Sub btnexit_Click(sender As Object, e As EventArgs) Handles btnexit.Click
Me.Close()
End Sub
End Class
Output:-
12) Develop the following form. When user clicks add button add the name in list box (Friend),
using list box (Friend) enter selected name in another list box (Invite), also remove-selected
name from list box
Design:-
Public Class exam
Private Sub btnaAdd_Click(sender As Object, e As EventArgs) Handles
btnaAdd.Click
Dim item As String
item = txtName.Text.Trim()
lstbxfriendlist.Items.Add(item)
End Sub
Private Sub btnRight_Click(sender As Object, e As EventArgs) Handles
btnRight.Click
For Each item In lstbxfriendlist.SelectedItems
lstbxSelectedfriendlist.Items.Add(item)
Next
If lstbxfriendlist.SelectedItems.Count > 0 Then
For checked As Integer = lstbxfriendlist.SelectedItems.Count - 1
To 0 Step -1
lstbxfriendlist.Items.Remove(lstbxfriendlist.SelectedItems(checked))
Next
End If
End Sub
Private Sub btnLeft_Click(sender As Object, e As EventArgs) Handles
btnLeft.Click
For Each item In lstbxfriendlist.SelectedItems
lstbxSelectedfriendlist.Items.Add(item)
Next
If lstbxfriendlist.SelectedItems.Count > 0 Then
For checked As Integer = lstbxfriendlist.SelectedItems.Count - 1
To 0 Step -1
lstbxfriendlist.Items.Remove(lstbxfriendlist.SelectedItems(checked))
Next
End If
End Sub
Private Sub btnDoubleleft_Click(sender As Object, e As EventArgs) Handles
btnDoubleleft.Click
For Each item In lstbxSelectedfriendlist.SelectedItems
lstbxfriendlist.Items.Add(item)
Next
If lstbxSelectedfriendlist.SelectedItems.Count > 0 Then
For checked As Integer =
lstbxSelectedfriendlist.SelectedItems.Count - 1 To 0 Step -1
lstbxSelectedfriendlist.Items.Remove(lstbxSelectedfriendlist.SelectedItems(ch
ecked))
Next
End If
End Sub
Private Sub btnDoubleright_Click(sender As Object, e As EventArgs)
Handles btnDoubleright.Click
For Each item In lstbxSelectedfriendlist.SelectedItems
lstbxfriendlist.Items.Add(item)
Next
If lstbxSelectedfriendlist.SelectedItems.Count > 0 Then
For checked As Integer =
lstbxSelectedfriendlist.SelectedItems.Count - 1 To 0 Step -1
lstbxSelectedfriendlist.Items.Remove(lstbxSelectedfriendlist.SelectedItems(ch
ecked))
Next
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Me.Close()
End Sub
End Class
Output:-

More Related Content

DOCX
activar office 2010
PDF
Visual Basic(Vb) practical
PDF
VB net lab.pdf
PDF
19.Advanced Visual Basic Lab.pdf
DOCX
Vbreport
PPT
ملخص البرمجة المرئية - الوحدة الرابعة
PPTX
Colegio municipal
DOCX
Visual basic bt0082
activar office 2010
Visual Basic(Vb) practical
VB net lab.pdf
19.Advanced Visual Basic Lab.pdf
Vbreport
ملخص البرمجة المرئية - الوحدة الرابعة
Colegio municipal
Visual basic bt0082

Similar to Docimp (20)

DOCX
Vbreport program
PPTX
Lesson 5 Introduction to Human Computer Interaction
DOCX
PT1420 File Access and Visual Basic .docx
DOC
PPTX
Updated Visual Basic 6 for beginners.pptx
PDF
Visualbasic tutorial
PPTX
Sharbani bhattacharya VB Structures
DOCX
.net progrmming part4
DOCX
Extra Credit Projects Microsoft Office Applications Sof.docx
PDF
National diploma in computer technology unesco-nigeria tve
PDF
DotNet Slip Solution_All_2019Pattern.pdf
DOCX
1. Determine the output displayed when the button is clicked. Priv.docx
DOCX
1. Determine the output displayed when the button is clicked.Priva.docx
DOC
Practicalfileofvb workshop
DOC
Ejemplo En Gamabas
PPT
Ch (2)(presentation) its about visual programming
PDF
Ict project pdf
PDF
Deepika Mittal , BCA Third Year
PDF
Linear Search Program in Visual Basic 2008
Vbreport program
Lesson 5 Introduction to Human Computer Interaction
PT1420 File Access and Visual Basic .docx
Updated Visual Basic 6 for beginners.pptx
Visualbasic tutorial
Sharbani bhattacharya VB Structures
.net progrmming part4
Extra Credit Projects Microsoft Office Applications Sof.docx
National diploma in computer technology unesco-nigeria tve
DotNet Slip Solution_All_2019Pattern.pdf
1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked.Priva.docx
Practicalfileofvb workshop
Ejemplo En Gamabas
Ch (2)(presentation) its about visual programming
Ict project pdf
Deepika Mittal , BCA Third Year
Linear Search Program in Visual Basic 2008
Ad

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
A Presentation on Artificial Intelligence
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
August Patch Tuesday
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
1. Introduction to Computer Programming.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A comparative study of natural language inference in Swahili using monolingua...
A Presentation on Artificial Intelligence
Spectroscopy.pptx food analysis technology
Programs and apps: productivity, graphics, security and other tools
Unlocking AI with Model Context Protocol (MCP)
SOPHOS-XG Firewall Administrator PPT.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
Teaching material agriculture food technology
Approach and Philosophy of On baking technology
Network Security Unit 5.pdf for BCA BBA.
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
Univ-Connecticut-ChatGPT-Presentaion.pdf
August Patch Tuesday
Assigned Numbers - 2025 - Bluetooth® Document
1. Introduction to Computer Programming.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Ad

Docimp

  • 1. 1) Display a message in a lable on click event of the button. Design:- Public Class Form1 Private Sub btnok_Click(sender As Object, e As EventArgs) Handles btnok.Click lblshow.Text += "Hello,window!" End Sub End Class
  • 3. 2) Create a simple VB.Net Project. Place a button on the form and show welcome message on the click of the button using msgbox() function. Design:- Private Sub btnclick_Click(sender As Object, e As EventArgs) Handles btnclick.Click MessageBox.Show("welcome") End Sub End Class
  • 5. 3) Accept two numbers using Inputbox on the click of the button and display SUM of these two numbers using Msgbox. Design:- Private Sub btnsumoftwonumber_Click(sender As Object, e As EventArgs) Handles btnsumoftwonumber.Click Dim a, b, c As Integer a = InputBox("Enter First no", "addition") b = InputBox("Enter Second no", "addition") c = a + b MessageBox.Show("ADDITION IS " + Convert.ToString(c), "addition") End Sub End Class
  • 8. 4) Design a form as shown below and perform the operations on the numbers entered. ResultTexbox mustbe readonly Design:- Public Class Form1 Private Sub btnplus_Click(sender As Object, e As EventArgs) Handles btnplus.Click Dim No1 As Integer = Convert.ToInt32(txtno1.Text) Dim No2 As Integer = Convert.ToInt32(txtno2.Text) Dim Result As Integer Result = No1 + No2 txtresult.Text = Result
  • 9. End Sub Private Sub btnminus_Click(sender As Object, e As EventArgs) Handles btnminus.Click Dim No1 As Integer = Convert.ToInt32(txtno1.Text) Dim No2 As Integer = Convert.ToInt32(txtno2.Text) Dim Result As Integer Result = No1 - No2 txtresult.Text = Result End Sub Private Sub btnmulti_Click(sender As Object, e As EventArgs) Handles btnmulti.Click Dim No1 As Integer = Convert.ToInt32(txtno1.Text) Dim No2 As Integer = Convert.ToInt32(txtno2.Text) Dim Result As Integer Result = No1 * No2 txtresult.Text = Result End Sub Private Sub btndiv_Click(sender As Object, e As EventArgs) Handles btndiv.Click Dim No1 As Integer = Convert.ToInt32(txtno1.Text) Dim No2 As Integer = Convert.ToInt32(txtno2.Text) Dim Result As Integer Result = No1 / No2 txtresult.Text = Result End Sub End Class
  • 11. 5) Write a program to find weather the given no is Positive, negative or zero. Design:- Private Sub btnclick_Click(sender As Object, e As EventArgs) Handles btnclick.Click Dim no As Integer = Convert.ToInt32(txtnum.Text) If no > 0 Then MessageBox.Show("Positive") txtnum.Clear() ElseIf no < 0 Then MessageBox.Show("Negative") txtnum.Clear() Else MessageBox.Show("Zero") txtnum.Clear() End If End Sub End Class
  • 13. 6) Write a program to find the maximum and minimum of given three numbers. Design:- Private Sub btnmin_Click(sender As Object, e As EventArgs) Handles btnmin.Click Dim no1 As Integer = Convert.ToInt32(txtno1.Text) Dim no2 As Integer = Convert.ToInt32(txtno2.Text) Dim no3 As Integer = Convert.ToInt32(txtno3.Text) If no1 < no2 And no1 < no3 Then MessageBox.Show(no1.ToString + " is minimum") ElseIf no2 < no1 And no2 < no3 Then MessageBox.Show(no2.ToString + " is minimum") ElseIf no3 < no1 And no3 < no2 Then MessageBox.Show(no3.ToString + " is minimum") End If End Sub Private Sub btnmax_Click(sender As Object, e As EventArgs) Handles btnmax.Click Dim no1 As Integer = Convert.ToInt32(txtno2.Text) Dim no2 As Integer = Convert.ToInt32(txtno2.Text) Dim no3 As Integer = Convert.ToInt32(txtno3.Text) Dim no1 As Integer = Convert.ToInt32(txtno2.Text) Dim no2 As Integer = Convert.ToInt32(txtno2.Text) Dim no3 As Integer = Convert.ToInt32(txtno3.Text) If no1 > no2 And no1 > no3 Then MessageBox.Show(no1.ToString + " is maximum") ElseIf no2 > no1 And no2 > no3 Then MessageBox.Show(no2.ToString + " is maximum") ElseIf no3 > no1 And no3 > no2 Then MessageBox.Show(no3.ToString + " is maximum") End If End Sub
  • 15. 7) Develop VB.NET application which calculates the simple interest = p*r*n / 100 and compound interest = p*(1+r/100)^n using textbox. In the same application take another form which calculates area and circumference of circle by declaring Pi as constant in module Design:- Private Sub btnsimple_Click(sender As Object, e As EventArgs) Handles btnsimple.Click Dim p As Integer = txtprincipal.Text Dim r As Integer = txtrate.Text Dim t As Integer = txttax.Text Dim ans As Integer ans = p * r * t / 100 MessageBox.Show(ans) End Sub Private Sub btncompound_Click(sender As Object, e As EventArgs) Handles btncompound.Click Dim p As Integer = txtprincipal.Text Dim r As Integer = txtrate.Text Dim t As Integer = txttax.Text Dim ans As Integer ans = p * (1 + r / 100) ^ t - p MessageBox.Show(ans) End Sub Private Sub btncircleradius_Click(sender As Object, e As EventArgs) Handles btncircleradius.Click Dim pi As Double = 3.14 Dim r As Integer = txtradius.Text Dim area As Double
  • 16. area = pi * r * r MessageBox.Show(area) End Sub End Class Output:-
  • 18. 8) Design a VB form as shown below to read the student data and generate the mark-sheet data. Clear the data when user clicks the “Clear” button. When user click on “Exit” then end the execution. Design:- Private Sub btngeneral_Click(sender As Object, e As EventArgs) Handles btngeneral.Click Dim sub1, sub2, sub3, sub4, sub5, sub6, total, per As Double sub1 = txtsub1.Text sub2 = txtsub2.Text sub3 = txtsub3.Text
  • 19. sub4 = txtsub4.Text sub5 = txtsub5.Text sub6 = txtsub6.Text total = sub1 + sub2 + sub3 + sub4 + sub5 + sub6 txttotal.Text() = total.ToString() per = total / 6 txtper.Text() = per.ToString() Dim grade As String If per >= 90 And per >= 100 Then txtgrade.Text = "A+" ElseIf per >= 80 And per <= 89 Then txtgrade.Text = "A" ElseIf per >= 70 And per <= 79 Then txtgrade.Text = "B+" ElseIf per >= 60 And per <= 69 Then txtgrade.Text = "B" ElseIf per >= 50 And per <= 59 Then txtgrade.Text = "C" ElseIf per >= 40 And per <= 49 Then txtgrade.Text = "C+" Else txtgrade.Text = "fail" If txtgrade.Text = "per <=49" Then txtgrade.Text = "fail" txtgrade.Enabled = False Else txtgrade.Enabled = True MessageBox.Show("fail") End If End If End Sub Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click txtname.Clear() txtrollno.Clear() txtsub1.Clear() txtsub2.Clear() txtsub3.Clear() txtsub4.Clear() txtsub5.Clear() txtsub6.Clear() txtgrade.Clear() txtper.Clear() txttotal.Clear() End Sub End Class
  • 21. 9) Design the digital watch using Timer Control. Design:- Private Sub TimerTime_Tick(sender As Object, e As EventArgs) Handles TimerTime.Tick lblhour.Text = Now.Hour lblmin.Text = Now.Minute lblsecond.Text = Now.Second End Sub Private Sub btnstart_Click(sender As Object, e As EventArgs) Handles btnstart.Click TimerTime.Start() End Sub Private Sub btnstop_Click(sender As Object, e As EventArgs) Handles btnstop.Click TimerTime.Stop() End Sub End Class
  • 23. 10) Design the following form. From the given combo boxes user has to select Starting value and ending value. When user clicks on “Prime nos” radio button then the prime nos. between the given ranges is displayed in the list box. Same as for other options. Design:-
  • 24. Private Sub rbevenno_CheckedChanged(sender As Object, e As EventArgs) Handles rbevenno.CheckedChanged lbdisplay.Items.Clear() Dim no, no1 As Integer no = cbstart.Text no1 = cbend.Text For item = no To no1 Step 1 If item Mod 2 = 0 Then lbdisplay.Items.Add(item) End If Next End Sub Private Sub rbprimeno_CheckedChanged(sender As Object, e As EventArgs) Handles rbprimeno.CheckedChanged Dim no, no1, i, f As Integer f = 0 no = cbstart.Text no1 = cbend.Text For item = no To no1 For i = 2 To item - 1 If item Mod i = 0 Then f = 1 Exit For Else f = 0 End If Next If f = 0 Then lbdisplay.Items.Add(item) End If Next End Sub Private Sub rboddno_CheckedChanged(sender As Object, e As EventArgs) Handles rboddno.CheckedChanged lbdisplay.Items.Clear() Dim no, no1 As Integer no = cbstart.Text no1 = cbend.Text For item = no To no1 Step 1 If item Mod 2 <> 0 Then lbdisplay.Items.Add(item) End If Next End Sub End Class Output:-
  • 27. 11) Develop following form. When user clicks on Submit button then all information will be printed in following textbox. When user clicks on Clear then all textboxes will clear. When user clicks on Exit button then application will be closed. Design:- Private Sub btnsubmit_Click(sender As Object, e As EventArgs) Handles btnsubmit.Click Dim l, f, a, rd As String Dim gender, hobbies As String gender = hobbies = "" f = txtname.Text
  • 28. l = txtlastname.Text a = txtaddress.Text If rbmarried.Checked = True Then rd = "Married" ElseIf rbunmarried.Checked = True Then rd = "UnMarried" End If If rbmale.Checked = True Then gender = "Male" ElseIf rbfemale.Checked = True Then gender = "Female" End If If cbread.Checked = True Then hobbies += "Read" End If If cbwrite.Checked = True Then hobbies += "Write" End If If cbspeak.Checked = True Then hobbies += "Speak" End If Dim selecteddate As Date selecteddate = dtpdateofbirth.Value Dim year As Integer = selecteddate.Year Dim month As Integer = selecteddate.Month Dim day As Integer = selecteddate.Day txtshow.Text = "First Name :" + f + " " + "Last Name :" + l + vbNewLine txtshow.Text += "Address : " + a + vbNewLine txtshow.Text += "Marital Status : " + rd + vbNewLine txtshow.Text += "Gender : " + gender + vbNewLine txtshow.Text += "EnglishAbility : " + hobbies + vbNewLine txtshow.Text += "Date Of Birth : " + day.ToString() + "/" + month.ToString() + "/" + year.ToString() + vbNewLine End Sub Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click txtname.Clear() txtlastname.Clear() txtaddress.Clear() End Sub Private Sub btnexit_Click(sender As Object, e As EventArgs) Handles btnexit.Click Me.Close() End Sub End Class
  • 30. 12) Develop the following form. When user clicks add button add the name in list box (Friend), using list box (Friend) enter selected name in another list box (Invite), also remove-selected name from list box Design:- Public Class exam
  • 31. Private Sub btnaAdd_Click(sender As Object, e As EventArgs) Handles btnaAdd.Click Dim item As String item = txtName.Text.Trim() lstbxfriendlist.Items.Add(item) End Sub Private Sub btnRight_Click(sender As Object, e As EventArgs) Handles btnRight.Click For Each item In lstbxfriendlist.SelectedItems lstbxSelectedfriendlist.Items.Add(item) Next If lstbxfriendlist.SelectedItems.Count > 0 Then For checked As Integer = lstbxfriendlist.SelectedItems.Count - 1 To 0 Step -1 lstbxfriendlist.Items.Remove(lstbxfriendlist.SelectedItems(checked)) Next End If End Sub Private Sub btnLeft_Click(sender As Object, e As EventArgs) Handles btnLeft.Click For Each item In lstbxfriendlist.SelectedItems lstbxSelectedfriendlist.Items.Add(item) Next If lstbxfriendlist.SelectedItems.Count > 0 Then For checked As Integer = lstbxfriendlist.SelectedItems.Count - 1 To 0 Step -1 lstbxfriendlist.Items.Remove(lstbxfriendlist.SelectedItems(checked)) Next End If End Sub Private Sub btnDoubleleft_Click(sender As Object, e As EventArgs) Handles btnDoubleleft.Click For Each item In lstbxSelectedfriendlist.SelectedItems lstbxfriendlist.Items.Add(item) Next
  • 32. If lstbxSelectedfriendlist.SelectedItems.Count > 0 Then For checked As Integer = lstbxSelectedfriendlist.SelectedItems.Count - 1 To 0 Step -1 lstbxSelectedfriendlist.Items.Remove(lstbxSelectedfriendlist.SelectedItems(ch ecked)) Next End If End Sub Private Sub btnDoubleright_Click(sender As Object, e As EventArgs) Handles btnDoubleright.Click For Each item In lstbxSelectedfriendlist.SelectedItems lstbxfriendlist.Items.Add(item) Next If lstbxSelectedfriendlist.SelectedItems.Count > 0 Then For checked As Integer = lstbxSelectedfriendlist.SelectedItems.Count - 1 To 0 Step -1 lstbxSelectedfriendlist.Items.Remove(lstbxSelectedfriendlist.SelectedItems(ch ecked)) Next End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Me.Close() End Sub End Class