-
May 4th, 2010, 12:09 PM
#1
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
Last edited by HanneSThEGreaT; May 4th, 2010 at 04:52 PM.
-
May 4th, 2010, 02:39 PM
#2
Re: New member could do with some pointers
You can use String.Format, or else just use Int (Integers) for division remainder
-
May 4th, 2010, 03:37 PM
#3
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
-
May 4th, 2010, 04:53 PM
#4
Re: New member could do with some pointers
Zanderman1980, please use [CODE] tags when posting code next time please.
Thank you
Hannes
-
May 4th, 2010, 06:28 PM
#5
Re: New member could do with some pointers
Originally Posted by HanneSThEGreaT
Zanderman1980, please use [CODE] tags when posting code next time please.
Thank you
Hannes
no probs mate sorry
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|