Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15549

Need a little help with vb2017...

$
0
0
Good afternoon everyone. I have what is probably a very simple problem dealing with a Timing program I am trying to write for a drag strip program that I'm trying to implement. I'm using a common online vb code that has been around for a while but would like to add a ListBox that would provide the (calculated) miles per hour for each of the times recorded. I'm a complete novice when it comes to vb and have been trying to make it work but with no success. The timing display looks like this

Name:  Ashampoo_Snap_Tuesday, October 20, 2020_13h46m20s_002_.jpg
Views: 19
Size:  37.1 KB

and the code that I have tried to modify is

Public Class Form1.pdf

If you cannot open the pdf file above, here is the code currently used.
_____________________________________________________________________

Public Class Form1
Private stopwatch As New Diagnostics.Stopwatch
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CenterToScreen()
Button3.Enabled = False
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim elapsed As TimeSpan = stopwatch.Elapsed
CircularProgressBar1.Text = String.Format("{1:00}:{2:00}",
Math.Floor(elapsed.TotalHours),
elapsed.Minutes, elapsed.Seconds)
Label1.Text = elapsed.Milliseconds
CircularProgressBar1.Value = elapsed.Seconds
If elapsed.Seconds = 0 Then
CircularProgressBar1.Value = 60
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Button1.Text = "Start" Then
Timer1.Start()
stopwatch.Start()
Button3.Enabled = False
Button1.Text = "Stop"
Else
Timer1.Stop()
stopwatch.Stop()
Button3.Enabled = True
Button1.Text = "Start"
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ListBox1.Items.Add(ListBox1.Items.Count + 1 & ". " & CircularProgressBar1.Text & ":" & Label1.Text)
ListBox2.Items.Add(500 / ListBox1.Items.Count & ". " & CircularProgressBar1.Text)
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
stopwatch.Reset()
ListBox1.Items.Clear()
ListBox2.Items.Clear()
CircularProgressBar1.Text = "00:00:00"
Label1.Text = "000"
End Sub
End Class

____________________________________________________________________
Basically, it is taking a fixed distance such as 500 (this is just a random number I will put in to make the mph come out what I want it to be) and divide it by each number recorded in ListBox1. The area I'm thinking would do this is what is listed under "Private Sub Button2"

Can anyone give me a little help in making this work.

Thank you in advance...

drluv
Attached Images
 
Attached Images

Viewing all articles
Browse latest Browse all 15549

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>