|
-
May 2nd, 2008, 10:18 PM
#1
Thread Starter
Junior Member
[2008] Aray Help
Ok, so I have this system working, now I need to know this.
If I had this
Code:
Dim Ary() As String = {"522", "462", "521", "461", "463", "581", "448", "586", "523", "468", "471"}
And when someone type into a textbox and click a button, how do I make the number from the Textbox find the number in the string and return what id in the string it is, like so if I was using 522 in the ary I have shown, it would highlight the first text in a combo box. Any ideas? If you didnt understand I will try to explain again.
-
May 2nd, 2008, 10:29 PM
#2
Re: [2008] Aray Help
I'd have to look, but there might be an Array.IndexOf method that would get what you are looking for. List has it, and Array should, too.
My usual boring signature: Nothing
 
-
May 2nd, 2008, 10:54 PM
#3
Thread Starter
Junior Member
Re: [2008] Aray Help
 Originally Posted by Shaggy Hiker
I'd have to look, but there might be an Array.IndexOf method that would get what you are looking for. List has it, and Array should, too.
I tried this
Code:
BikesBox.SelectedItem = Ary.IndexOf(Ary, TextBox2.Text)
But it didn't find the 522 entry in the array
-
May 2nd, 2008, 11:37 PM
#4
Frenzied Member
Re: [2008] Aray Help
this should work
Code:
MsgBox(Array.IndexOf(Ary, TextBox1.Text))
-
May 3rd, 2008, 02:32 AM
#5
Re: [2008] Aray Help
 Originally Posted by JaTochNietDan
I tried this
Code:
BikesBox.SelectedItem = Ary.IndexOf(Ary, TextBox2.Text)
But it didn't find the 522 entry in the array
Isn't it a bit of a worry that the method you're calling is named IndexOf yet the property you're setting is the SelectedItem. If you're getting an index then shouldn't you be setting the SelectedIndex?
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
|