Hi Tony,
I did make an example for you, but to be sure you learn something from it, I
did not check if it did work right. I could be much nicer, but with only 1
button and 2 textboxes that is difficult.
I would check it good if I was you, because I really did not check it.
Just a way how you could use the code.
\\\\
'Distance = Speed * Time
'Speed = Distance / Time
'Time = Distance / Speed
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Button1.Text = "Distance"
Me.TextBox1.Text = "Speed"
Me.TextBox2.Text = "Time"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If IsNumeric(Me.TextBox1.Text) And IsNumeric(Me.TextBox1.Text) Then
Select Case Me.Button1.Text
Case "Distance"
Me.TextBox1.Text = (CDbl(Me.TextBox1.Text) *
CDbl(Me.TextBox2.Text)).ToString
Me.TextBox2.Text = "Time"
Me.Button1.Text = "Speed"
Case "Speed"
Me.TextBox2.Text = (CDbl(Me.TextBox1.Text) /
CDbl(Me.TextBox2.Text)).ToString
Me.TextBox1.Text = "Distance"
Me.Button1.Text = "Time"
Case "Time"
Me.TextBox1.Text = (CDbl(Me.TextBox1.Text) /
CDbl(Me.TextBox2.Text)).ToString
Me.TextBox2.Text = "Time"
Me.Button1.Text = "Distance"
End Select
Else
If Not IsNumeric(Me.TextBox1.Text) Then
Me.TextBox1.Text = "Error"
Else
Me.TextBox2.Text = "Error"
End If
End If
End Sub
////
Hi, my name is tony
I'm new to VB.Net I'm having trouble writing a Function
Procedure For
Distance = Speed * Time
Speed = Distance / Time
Time = Distance / Speed
With two textboxes, one label, one button to calculate,
I'm still having trouble calling on the procurers. I get a
variety of different answers as I change it but none are
close.
If any body has any suggestions or could recommend a good
book would appreciate.
I'm in class at BCCC but the teacher is new at it And all
the tutors have only had VB.6 And seem to be confused on
this, I was doing good up till know, Need any help or
suggestions any may have that could.