Dim StrArray() as string
The following code can check the words.
Private Sub TextBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Return Then
If FindWords(Trim(TextBox1.Text)) Then
Private Function FindWords(ByVal FString As String) As Boolean
Dim Result As Boolean = False
If StrArray.Contains(FString) Then
Result = True
When you type any key on your keyboard, it supplies a unique value to the CPU, by which CPU can understand which key is pressed.
For every work system performs an event. By e we can try to know which event system performs.
Here by e.KeyCode we get the information about the key which is pressed.
Every Key has unique KeyCode. Keys.Return means you press the Enter key.
In TextBoxKeyDown or KeyUp event, if you write e.KeyCode = then you can get all KeyCodes List for every keys of your keyboard.
In the above post, I introduce the TextBox KeyDown event. This event performs when you down any key of your keybord. After writing a word in the TextBox press the Enter key, it shows different message if it finds or not.