autocomplete?

  • Thread starter Thread starter Jarod_24
  • Start date Start date
J

Jarod_24

The "Run program" dialog and the Internet explorer adress bar got the
autocomplete effect, where what you type is matched against previous visited
adresses.

Anybody know how can i create a textbox/listbox that will have this effect
in my own program?
 
The "Run program" dialog and the Internet explorer adress bar got the
autocomplete effect, where what you type is matched against previous visited
adresses.

Anybody know how can i create a textbox/listbox that will have this effect
in my own program?

You will want to look at the ListBox's FindString method...

Off the top of my head and untested - so you may need to tweak it a
little :)

Private Sub textBox1_KeyUp(ByVal Sender As Object, ByVal e As KeyEventArgs)
Dim index As Integer
Dim start As Integer

If textBox1.Text.Length <> 0 AndAlso e.KeyCode <> Keys.Back Then
start = textBox1.SelStart
index = listBox1.FindString(textBox1.Text, -1)

If index <> ListBox.NoMatches Then
listBox1.SelectedIndex = index
textBox.Text = CType(listBox1.Items(index), String)
textBox.Select(start, textBox1.Text.Length - start)
End If
End If
End Sub

Not sure if this is exactly what you wanted or not...
 
The "Run program" dialog and the Internet explorer adress bar got the
autocomplete effect, where what you type is matched against previous visited
adresses.

Anybody know how can i create a textbox/listbox that will have this effect
in my own program?

My Dinky AutoComplete Tool provides what you're looking for

Palo
 
Back
Top