finitesimian
Programmer
I'm trying to make a form with a listbox control that outputs strings based on information typed into a textbox control------however, the way I WANT to do it is have it incrementally list the words (from an array) as the user is entering the data. For example - If the user enters the letters "com", the listbox displays all the words that start with the letter "c".....then "co"....then "com" as the person is typing (the list obviously reduces itself in size as the person types).
I have it worked out conceptually......but I haven't figured out the right way to say it. Here is an example:
I have it worked out conceptually......but I haven't figured out the right way to say it. Here is an example:
Code:
Declare function findname(identifier$, action, suppvalue)
Global output_array(9) As String
'----------------------------------------
Sub Main()
' opens dialog box
Begin Dialog newdlg 91, 36, 209, 127, "Locate name:", .findname
OkButton 153, 12, 50, 14
CancelButton 153, 30, 50, 14
ListBox 5, 52, 202, 74, output_array, .ListBox1
TextBox 5, 33, 124, 13, .TextBox1
OptionGroup .OptionGroup1
OptionButton 6, 4, 85, 10, "Name", .OptionButton1
OptionButton 6, 18, 85, 10, "Location", .OptionButton2
End Dialog
Dim mydialog As newdlg
On Error Resume Next
Dialog mydialog
If Err=102 Then
Stop
End if
'Here is what it needs to do:
'Dim wordscan As String
'For x = 1 to 9
'zor = len(mydialog.textbox1)
'wordscan = left(county_name(x),zor)
'If wordscan = left(mydialog.textbox1,zor) then
'n = n + 1
'redim output_array(n)
'output_array(n) = county_name(x)
'End if
'Next
End sub
'----------------------------------------
'This function needs to control the list of words in the listbox.
'I know my "for next" statement needs to go here somewhere
'I just don't know where to put it or how to say it
Function findname(identifier$, action, suppvalue)
Select Case action
Case 1
Case 2
Select case DlgControlID(identifier$)
Case 5
output_array(0) = "Adam"
output_array(1) = "Bernard"
output_array(2) = "Corey"
output_array(3) = "David"
output_array(4) = "Eric"
output_array(5) = "Frank"
output_array(6) = "George"
output_array(7) = "Henry"
output_array(8) = "Igor"
output_array(9) = "Jason"
Case 6
output_array(0) = "Arkansas"
output_array(1) = "Boston"
output_array(2) = "California"
output_array(3) = "Detroit"
output_array(4) = "Eerie"
output_array(5) = "Frankfurt"
output_array(7) = "Grand Rapids"
output_array(8) = "Holland"
output_array(9) = "Illinois"
End Select
Case 3
Case 4
Case 5
End select
End Function