Hi Richard,
I'll see if I can make this a little more clear, but I think I'm getting the
jist of it.
The user enters a keyword to search through a ton of strings held in an
array.
Right, what about using a HashTable,
Dim pop as new HashTable
pop.add("key","object") 'Add an object to the hastable, key can be
*any* object as can object.
pop.contains("key") 'Check the existance of "key" within the
hashtable, again, key can be *any* object
Hashtables are so much quicker to use than array's especially if you
would like to search for a specific entry, you will find that you can find a
specific object within a hashtable containing thousands upon thousands of
objects within milliseconds!
Are you just checking to see if the keyword matches a list of keywords?
Remember that you can add *any* object into the hashtable and have it
"associated" with the keyword so to speak, so lets say you have a specific
class which performs a certain task on a value,
Public Interface MyInterface
Function doStuff(Byval iValue as integer) as integer
End Interface
Public Class addOne
Implements MyInterface
Public Function doStuff(Byval iValue as integer) as integer implements
MyInterface.doStuff
Return(iValue + 1)
End Function
End Class
Public Class takeOne
Implements MyInterface
Public Function doStuff(Byval iValue as integer) as integer implements
MyInterface.doStuff
Return(iValue - 1)
End Function
End Class
Dim pop As New Hashtable()
pop.Add("addone", New addOne())
pop.Add("takeone", New takeOne())
Dim poo As Integer = 10
MessageBox.Show(CType(pop.Item("addone"), MyInterface).doStuff(poo))
MessageBox.Show(CType(pop.Item("takeone"), MyInterface).doStuff(poo))
I hope this helps!!
Nick.