Hi !
I have a program that has 2 textboxes, one is multiline where some text is showed, and second is normal where i type commands.Everything worked until i added second command to normal textbox.I added a else function to show "Unknown command" when i type something else than "help"
The problem is that when i added second if to check if text is "tutorial" i cant type anything into the textbox, because after i type one letter it says its unknown command and clears textbox (i also added textbox clearing) Code:
So other words, after adding second if my textbox accepts only one letter and then automatically presses enter, causing a unknown command.Where is the problem ?
BTW newline is defined at Public Class Form1 and its "Dim newline As String = Environment.NewLine"
I have a program that has 2 textboxes, one is multiline where some text is showed, and second is normal where i type commands.Everything worked until i added second command to normal textbox.I added a else function to show "Unknown command" when i type something else than "help"
The problem is that when i added second if to check if text is "tutorial" i cant type anything into the textbox, because after i type one letter it says its unknown command and clears textbox (i also added textbox clearing) Code:
Code:
Private Sub inputBoxKeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles inputBox.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
If console_input.Text = "help" Then
'show
console.Text += "Help:" + newline
console.Text += "TEST ONLY " + newline
End If
If console_input.Text = "tutorial" Then
console.Text += "Loading tutorial..." + newline
sleeptimer.Interval = 1000
sleeptimer.Enabled = True
console.Text += "Tutorial:" + newline
End If
Else : console.Text += "[UNKNOWN COMMAND '" & console_input.Text & "']" + newline
End If
console_input.Text = ""
End SubBTW newline is defined at Public Class Form1 and its "Dim newline As String = Environment.NewLine"