Hey everyone! I am new to using Visual Basic, and i need help!! Im tryin to create a 2-d linear search array, where if i type in a 2 letter code, it would come back with a name linked to that code!!
for example, if i typed in "ca" into textbox1, it would return with "california" in textbox2, and so on!!
so far my search looks like this
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim areacode As String(,) = {{"CA","NY"}, {"California","New York"}}
Dim Index As Integer = 0
Dim code As String
code = TextBox1.Text
Do Until areacode(index) = code_
Or_
code(index) = "end"
index = index + 1
Loop
If areacode(index) = code Then
TextBox2.Text = areacode(index)
Else
TextBox2.Text = "Error Not Found"
End IF
End Sub
If anyone could help me with this it would be highly appreciated!!!!
for example, if i typed in "ca" into textbox1, it would return with "california" in textbox2, and so on!!
so far my search looks like this
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim areacode As String(,) = {{"CA","NY"}, {"California","New York"}}
Dim Index As Integer = 0
Dim code As String
code = TextBox1.Text
Do Until areacode(index) = code_
Or_
code(index) = "end"
index = index + 1
Loop
If areacode(index) = code Then
TextBox2.Text = areacode(index)
Else
TextBox2.Text = "Error Not Found"
End IF
End Sub
If anyone could help me with this it would be highly appreciated!!!!