|
-
Mar 8th, 2009, 03:47 AM
#1
Thread Starter
New Member
[RESOLVED] [2008] User input data from textbox into an array
I'm trying to make a program where user can input data from a textbox into an array and when the user hit the enter key, it compare it to a data grab from a text file. Here is my code so far:
Private Sub TextBox_KeyDown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox.TextChanged
Dim input As String
Dim KeyCode As Integer
input = CStr(TextBox.Text)
If KeyCode = 13 Then
If InStr(1, varia3, input, vbTextCompare) <> 0 Then golden = True
If golden = True Then msgbox("match")
If golden = False Then msgbox("mismatch")
End If
End Sub
I got the part where the program can graph data from text file and put it into an array called "varia3". The part I could not get is allowing user to enter data into the textbox. When I run the program, the sec I try to enter a letter or number into the textbox the program ended.
-
Mar 8th, 2009, 08:49 AM
#2
Re: [2008] User input data from textbox into an array
Use the KeyDown event;
Code:
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
If varia3 = TextBox1.Text Then
MsgBox("match")
Else
MsgBox("mismatch")
End If
End If
End Sub
-
Mar 8th, 2009, 12:10 PM
#3
Thread Starter
New Member
Re: [2008] User input data from textbox into an array
This code seems a lot better, but it still won't allow user to enter data. When I ran the program, the sec I enter a letter or numbers the program ended.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|