New member could do with some pointers
Hi all im trying to make a simple program that calculates the time it takes to cover x amount off nautical miles at x amount off knots, the code i have so far is this :
Code:
Public Class Form1
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Dim s As String
s = TextBox3.Text
s = Mid(s, 2, 3)
TextBox4.Text = s
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
TextBox5.Text = Val(TextBox4.Text) * 60
End Sub
End Class
so if i say want to cruise 29 miles at 12 knts it gives me an awnser of 2 hours 24.6 mins instead of 2 hours 25. Although i do realise that 2 hrs 24.6 is technicaly right i was wondering if anyone here could help me with getting it into the correct format?
many thanks alex
ps i possibly should have said im using VS2010 :)
Re: New member could do with some pointers
You can use String.Format, or else just use Int (Integers) for division remainder
Re: New member could do with some pointers
Thanks for that ill give it a go, im quiet new to the whole programing thing so im not sure iff ill crack it but ill have a good attemt. Will let you know how it goes :)
Re: New member could do with some pointers
Zanderman1980, please use [CODE] tags when posting code next time please.
Thank you
Hannes
Re: New member could do with some pointers
Quote:
Originally Posted by
HanneSThEGreaT
Zanderman1980, please use [CODE] tags when posting code next time please.
Thank you
Hannes
no probs mate sorry :)