We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
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
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.
am not sure I understood the question but can’t you just calculate it using the property location ?
-
Show mouse in screenshot in vb .net? - 3 Answers
Show mouse in screenshot in vb .net??? Is there a way to show the mouse when making a screenshot using a form in vb .net? Ple...
-
Combine 2 picture boxes in vb .net? - 2 Answers
Combine 2 picture boxes in vb .net? Is it possible? like so that one images is overlayed on top of another one and then saved...
-
Inivatuon code?? - 1 Answers
What is an inivation code??
-
ferrari chat code for ps2 - 1 Answers
how to get ferrari cheat code for ps2~
-
My id code - 1 Answers
Where to put in my message id code
-
Where I can get HTML codes for my site? - 1 Answers
From where I can get HTML codes for my site?
-
Caller I.d. codes - 1 Answers
Codes for call restriction & block/unblock phone caller I.d.
-
Internet Security WEP code - 1 Answers
how do I find out what my WEP # is
-
Code for stars - 1 Answers
What are the keys for inputting stars and skulls?
-
Key codes for fta recivers - 1 Answers
How@where do I enter them ?
Belgium Web Net
Internet, Web Design, Digital Marketing
The Code Mood
Technology, Web Development, Programming
Roku Activation Code
Technology, E-commerce, Domain Sales
QR Code Tiger
Software, Technology, Internet Services