Alrighty...
I want to say:
But i cant just use Array() or arrayCode:If <Variable> = Array1(<any item in the array>) then
do something
end if
Second,
Can you alphabitize objects in an array?
Printable View
Alrighty...
I want to say:
But i cant just use Array() or arrayCode:If <Variable> = Array1(<any item in the array>) then
do something
end if
Second,
Can you alphabitize objects in an array?
VB Code:
Dim ary() As String = {"one", "two", "three"} If ary(1) = "two" Then MessageBox.Show("second element is : Two") End If
Maybe you mean this one .
VB Code:
Dim ary() As String = {"one", "two", "three"} Dim str As String = "two" If str = ary(1) Then MessageBox.Show("second element is : Two") End If
Depending on what is contained in the array you can probably use:
VB Code:
Dim ary() As String = {"one", "two", "three"} Dim idx As Integer=ary.IndexOf("one") If idx > -1 Then MessageBox.Show(String.Format("Found in element: {0}",idx)) End If
I think E is more twards what i want, but havent tested it, will that check the whole array for what im looking for?
Dim idx As Integer=ary.IndexOf("one")
that isnt working for me
Yes and return the index of the first found match. Although if the array contains objects then it may try to match an instance which can be tricky. Although I'm not sure of this, I haven't actually tested it yet.
Well, i want it to do something if there is NO match
It returns -1 if there is no match found.
Ah cool, but...
users.LastIndexOf(uid)
Overload resolution failed because no accessible 'LastIndexOf' accepts this number of arguments.
You are using the wrong method its not LASTIndexOf its just IndexOf.