Assume you have a form containing a listbox, lstDogs. Write code for the button handler that will use an Input Box to ask the user to enter a dog breed such as Cocker Spaniel, Collie, etc. The program should keep asking for dogs until the user hits the Enter key with no input or clicks the "Cancel" button. (This is easier than you might think).
Private Sub btnRun_Click(sender As Object, e As
EventArgs) Handles btnRun.Click
<========= your code goes here ============>
End Sub
Visual Basic Windows application :
Step1: Design the form with the list box and button as shown below.

Step2:
Set the name property of List box as lstDogs and btnRun for Button1
Step3: Double click the Run button and write below code
Public Class Form1
'Double click the the Run button and write below
code
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click
'clear the items before click Run button
lstDogs.Items.Clear()
'declare a string dogBreed
Dim dogBreed As String
'prompt for dog breed string
dogBreed = InputBox("Input Dialog", "Enter dog breed", "")
'check if user entered breed is not empty and not enter key
While Not dogBreed.Equals("")
'add the dogBreed to the lstDogs
lstDogs.Items.Add(dogBreed)
'prompt for dog breed string
dogBreed = InputBox("Input Dialog", "Enter dog breed", "")
End While
End Sub
End Class
Step4:



Assume you have a form containing a listbox, lstDogs. Write code for the button handler that...
I need help with this problem in Visual Basic 2012: Write a program that allows the user to specify two numbers and then adds, subtracts, multiplies, or divides them when the user clicks on the appropriate button. The output should give the type of arithmetic performed and the result. Whenever one of the numbers in an input text box is changed, the output text box should be cleared. Also, if the number 0 is entered into the second text box,...
WITH THIS CODE, ADD TO THE EXIT BUTTON THAT ALLOWS THE USER TO SEE UPON EXITING, HOW MANY QUESTIONS THEY GOT RIGHT AND WRONG. Public Class Form1 Dim r As Random = New Random Dim no1, no2 As Integer Private Sub rdbAdd_CheckedChanged(sender As Object, e As EventArgs) Handles rdbAdd.CheckedChanged txtAnswer.Clear() txtAnswer.BackColor = Color.White no1 = randomInt() no2 = randomInt() lblOperation.Text = "+" txtNumber1.Text = no1.ToString() txtNumber2.Text = no2.ToString() End Sub Public Function randomInt() As Integer Return r.Next(20, 120) End Function...
UI:
Provided Code:
Public Class Form1
Private Sub btnExit_Click(sender As Object,
e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnCalculateDueDays_Click(sender As Object, e As
EventArgs) Handles btnCalculateDueDays.Click
End Sub
End Class
tick bitwise Or operation Work with dates and times Exercise 9-1 In this exercise, you'll use the Date Time and TimeSpan st I. Open the application th ructures. n that's in the CIVB 2015iChapter 09DateHandlin a form that accepts a future date a directory. Within this project,...
Program using visual basic.net You will create a very simple two numbers calculator with save options; here is the specifications for the application. Create a form divided vertically in two halves with right and left panels 1- In the left panel you will create the following control, the label or the value of the control will be in "" and the type of the control will in [] a- "First Number" [textbox] b- "Second number" [texbox] c- "Result" [textbox] -...
This is done in visual basic langauge. I created a
query and i want to invoke this query from code.
for example, if i select the Company-owned radio button and hit the
display button ONLY the information for company owned stores should
be shown. same for the other radio button except it will only show
the information for the Franchise ownership.
F. for Franchises
C. for company owned
please provide the appropriate code.
and select statements.
hon Mcescft Vsal Studio...
Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: From To Conversion Miles - Kilometers: 1 mile = 1.6093 kilometers Kilometers - Miles: 1 kilometer = 0.6214 miles Feet - Meters: 1 foot = 0.3048 meters Meters - Feet: 1 meter = 3.2808 feet Inches - Centimeters: 1 inch = 2.54 centimeters Centimeters - Inches: 1...
This is just part of a C# windows form
Application. When the user enters their information,
checks the check box to save info and hits the payment button the
information is saved to a .txt file. When user enters last name and
clicks autofill if name is found in file it will auto fill the
boxes but i'm having issues with this part. For some reason it
skips the firstname box and enters the last name in the first name...
Visual Basic 2015: Extra 18-1 Use inheritance with the Inventory
Maintenance Application
Source Code:
1. frmNewItem.vb
Public Class frmNewItem
Public InvItem As InvItem
Private Sub frmNewItem_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Me.LoadComboBox()
End Sub
Private Sub LoadComboBox()
cboSizeOrManufacturer.Items.Clear()
If rdoPlant.Checked Then
cboSizeOrManufacturer.Items.Add("1 gallon")
cboSizeOrManufacturer.Items.Add("5 gallon")
cboSizeOrManufacturer.Items.Add("15 gallon")
cboSizeOrManufacturer.Items.Add("24-inch box")
cboSizeOrManufacturer.Items.Add("36-inch box")
Else
cboSizeOrManufacturer.Items.Add("Bayer")
cboSizeOrManufacturer.Items.Add("Jobe's")
cboSizeOrManufacturer.Items.Add("Ortho")
cboSizeOrManufacturer.Items.Add("Roundup")
cboSizeOrManufacturer.Items.Add("Scotts")
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs)
Handles btnSave.Click
If IsValidData() Then
InvItem = New InvItem(CInt(txtItemNo.Text),...
In this exercise, you’ll add code to a form that converts the
value the user enters based on the selected conversion type.
The application should handle the following conversions:
1. Open the Conversions project. Display the code for the form,
and notice the rectangular array whose rows contain the value to be
displayed in the combo box, the text for the labels that identify
the two text boxes, and the multiplier for the conversion as shown
above. Note: An array...
How can I add this function to my C# code?:
Validate that if the user clicks the “OK” button, a “Seating
Category” is selected, and at least one ticket is being purchased.
If not, pop-up a dialog box asking the user to enter the needed
data for the transaction. What we want to avoid is depicted in See
Figure 3.
Figure 3:
This code asks for a seating category to be selected, how many
tickets to be purchased, and if...