Sorry, I realize this question is kind of basic, but I have these three textboxes and a calculator keypad on my form. I am trying to get whatever textbox is the current focus to get the input, but for some reason my input is going to all three, can anyone help here?
Code:
Public Class Graph
Private Sub ZeroButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZeroButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "0")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "0")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "0")
End If
End Sub
Private Sub OneButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OneButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "1")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "1")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "1")
End If
End Sub
Private Sub ButtonTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonTwo.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "2")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "2")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "2")
End If
End Sub
Private Sub ThreeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThreeButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "3")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "3")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "3")
End If
End Sub
Private Sub FourButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FourButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "4")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "4")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "4")
End If
End Sub
Private Sub FiveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FiveButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "5")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "5")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "5")
End If
End Sub
Private Sub SixButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SixButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "6")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "6")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "6")
End If
End Sub
Private Sub SevenButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SevenButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "7")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "7")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "7")
End If
End Sub
Private Sub EightButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EightButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "8")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "8")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "8")
End If
End Sub
Private Sub NineButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NineButton.Click
If Xmin_Box.Focus = True Then
Xmin_Box.Text = String.Concat(Xmin_Box.Text, "9")
End If
If Xmax_box.Focus = True Then
Xmax_box.Text = String.Concat(Xmax_box.Text, "9")
End If
If Interval_box.Focus = True Then
Interval_box.Text = String.Concat(Interval_box.Text, "9")
End If
End Sub
End Class