Categories
- Beauty & Style
- Computers & Tech
- Education & School
- Entertainment
- Environmental Issues
- Food & Dining
- FunAdvice Community
- Gaming & Games
- General Knowledge
- Health
- Home & Garden
- Jobs & Money
- Kids
- Love & Relationships
- Music
- Nutrition & Fitness
- Parents & Family
- Pets & Animals
- Politics
- Religion & Spirituality
- Science
- Shopping
- Sports
- Travel
- Writing & Literature
Here try this:
___
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnCalculation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim intSpeed As Integer
Dim intTime As Integer
Dim intDistance As Integer
Dim intTotalDist As Integer
Dim intCount As Integer
Dim strDistance As String
Dim strTotalDist As String
Dim strMessage As String
Dim strSpeedInput As String
Dim strSpeedOutput As String
Dim strTimeInput As String
Dim strTimeOutput As String
Dim strList As String
Dim strError As String
'Clear the list box
lstDisplay.Items.Clear()
'Prompt for the speed of the vehicle
strMessage = Please enter the speed of the vehicle in miles-per-hour
strSpeedInput = InputBox(strMessage, Speed Input)
intSpeed = Val(strSpeedInput)
'Check for valid speed
If intSpeed = 1 Then
'Prompt for the time
strMessage = Please enter the time to travel in hour
strTimeInput = InputBox(strMessage, Time Input)
intTime = Val(strTimeInput)
'Check for valid time
If intTime = 1 Then
'Display speed output
strSpeedOutput = Vehicle speed: intSpeed MPH
lstDisplay.Items.Add(strSpeedOutput)
'Display time output
strTimeOutput = Time traveled: intTime hours
lstDisplay.Items.Add(strTimeOutput)
'Display hour and distance labels
strDistance = Hour Distance Traveled
lstDisplay.Items.Add(strDistance)
'Calculate Distance
intCount = 1
Do Until intCount intTime
intDistance = intSpeed * intCount
'Display the value of time and distance in the list box
strList = intCount intDistance
lstDisplay.Items.Add(strList)
intCount += 1
Loop
'Display the total distance
intTotalDist = intSpeed * intTime
strTotalDist = Total Distance: intTotalDist mile(s)
lstDisplay.Items.Add(strTotalDist)
Else 'Invalid time
strError = The time needs to be greater or equal to 1 hour
MessageBox.Show(strError, Invalid Time Data, MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else 'Invalid speed
strError = The speed needs to be greater or equal to 1 mph
MessageBox.Show(strError, Invalid Speed Data, MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
___
That is all I got for the program in VB.
Answer this Question: "Code snippets in vb.net"
Our members said the answers on this page also answer the following questions:
Distance calculating vb.net code snippets, Chekc valid time using vb.net, Vb 2008 snippets, Vb listbox calculate distance, Vb listbox display calculate distance, Vb.net check 2 pictures equal, Vb distance per hour loop, Vb.net snippets, Snippet vb.net, Measure distance image vb.net, Vb.net from to distances and time, Distance from speed and time visual basic code, Strspeedoutput = "vehicle speed: " intspeed "mph" lst display.items., Adding string to listbox then calculate in vb, Distance traveled visual basic code, How to make vb.net snippets
Popular questions related to Code snippets in vb.net
- How to make the middle section of my Myspace black?
- How do I see someone's private Myspace without being their friend?
- Myspace code for moving words in a line
- How to activate my cellphone?
- How to disable Deepfreeze 6 Permanently?
- How to make text bold on myspace?
- How do you get your IMVU profiles like this?
- LG LOTUS 'this time' ringtone???
- Vegas Movie Studio Platinum 9.0 authentication code?
- Bebo Codes
- How can I make a default layout for Myspace?
- How to get free minutes on a Boost mobile phone?
- html codes for myspace
- Interest codes for myspace. help!
- Myspace code to hide only some of my comments not all!
- Can you help with my Myspace display name?
Computers & Tech Questions
Sample codings in vb.net
Code snippets
Show mouse in screenshot in vb .net?
Combine 2 picture boxes in vb .net?
Code! Code!
Share this question
Copy and paste this code:It will display on your blog or site like this:
Code snippets in vb.net



Code snippets in vb.net
I have to do the distance calculation project.so I located the two images in design page.there arise the problem!!
How to calculate the distance between the two images in the design page.there is no need to bother about the height ,width etc...
Pls...
help me