CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Dec 2009
    Posts
    6

    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.

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
  •  





Click Here to Expand Forum to Full Width

Featured