New member could do with some pointers
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: New member could do with some pointers

  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.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: New member could do with some pointers

    You can use String.Format, or else just use Int (Integers) for division remainder
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Dec 2009
    Posts
    6

    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

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,091

    Re: New member could do with some pointers

    Zanderman1980, please use [CODE] tags when posting code next time please.

    Thank you

    Hannes

  5. #5
    Join Date
    Dec 2009
    Posts
    6

    Re: New member could do with some pointers

    Quote Originally Posted by HanneSThEGreaT View Post
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center