anybloodyid
Member
- Joined
- Jan 25, 2018
- Messages
- 16
- Programming Experience
- Beginner
Hi and sorry if this is posted in wrong place only just joined.
I want to send input from a textbox to 4 labels, so enter text hit return input goes to label1, enter more text input goes to label2 etc
The code below is how I worked it out but I feel sure there must be a better way, is there?
I want to send input from a textbox to 4 labels, so enter text hit return input goes to label1, enter more text input goes to label2 etc
The code below is how I worked it out but I feel sure there must be a better way, is there?
VB.NET:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Public Class GlobalVariables
Public Shared num As Integer = 1
End Class
Private Sub Txt_input_KeyDown(sender As Object, e As KeyEventArgs) Handles Txt_input.KeyDown
If e.KeyCode = Keys.Enter Then
Select Case GlobalVariables.num
Case 1
Lbl_player1.Text = Txt_input.Text
Txt_input.Text = ""
GlobalVariables.num = 2
Case 2
Lbl_player2.Text = Txt_input.Text
Txt_input.Text = ""
GlobalVariables.num = 3
Case 3
Lbl_player3.Text = Txt_input.Text
Txt_input.Text = ""
GlobalVariables.num = 4
Case 4
Lbl_player4.Text = Txt_input.Text
Txt_input.Text = ""
GlobalVariables.num = 0
End Select
End If
End Sub
End Class