I am using Visual Basic Express, I hope you all still can help me. This program is used to calculate a cars speed related to speed limit. It has two user inputs, cars speed and speed limit. It will calculate any two digit # and one digit #, but when I input a three digit # the output comes out as 0. Please Help!!! (Just trying to learn, ThankYou)
PublicClass Form1
PrivateSub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i AsDouble = 0 '// Declaring Variabe as Integer Data Type
If TextBox1.Text > TextBox2.Text Then'// If Box 1 is greater than box 2
DoWhile i < Double.Parse(TextBox1.Text - TextBox2.Text) '// while i(which is equal to zero) is less than our integer, Box 1 - Box 2
i += 1 '// i = i + 1, 0 = 0 + 1 ?????
Loop
MessageBox.Show("The Calculated speed is " & i.ToString() & " miles under the speed limit.") '// Message in our MessageBox
TextBox1.Text = ""
TextBox2.Text = "" Else
If TextBox1.Text < TextBox2.Text Then
DoWhile i < Double.Parse(TextBox2.Text - TextBox1.Text) '// while i(which is equal to zero) is less than our integer, Box 2 - Box 1
i += 1 '// i = i + 1, 0 = 0 + 1 ?????
Loop
MessageBox.Show("The Calculated speed is " & i.ToString() & " miles over the speed limit.") '// Message in our MessageBox
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.