Can I force the user of my program to strict to the list of autocomplete feature of a textbox and a combobox I want the user to use just the items in the autocomplete list
VB2005
Can I force the user of my program to strict to the list of autocomplete feature of a textbox and a combobox I want the user to use just the items in the autocomplete list
VB2005
TextBox & ComboBox Autocomplete
Kosmo007
smadhu
I know that and I use it
but I want a control like the combo box in microsoft access whe you set that values to be fetched from a table and you use strict to menu the user can type in the text section of the combo but in this control you can't do that
gpugelni
David Hanzelka
- No not working for combobox
- I want It for a textbox as stanalone component
- and also for combo box with dropdownstyle set to drop down
my question still unanswered
davidjmsdn
thank you rkimble this is what I want
but can you make me a little example how I can do this in code
Havoc the Humble
Handle the Validating event for the control. In this handler, check to see if the autocomplete source contains the text in the control. If not, set e.Cancel = True.
This will force the user to select an item that exists in the autocomplete source while still allowing them to type in the value.
luckymaheshwari
if you mean a combobox on its own and the textbox being the field in the combobox then yes...
Select the combobox properties.
Set the "AutoCompleteMode" to suggestappend
set the AutoCompleteSource to CustomSource
I think you can do this for the textbox control itself too but not exactly sure how to bind it to the combobox list. I hope however this gives you a starting point
Wei Ming
Sure, but can you tell me what your autocomplete source is
If you're using the CustomSource then the code could be as simple as:
Private Sub TextBox1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
If Not Me.TextBox1.AutoCompleteCustomSource.Contains(Me.TextBox1.Text) Then
e.Cancel = True
End If
End Sub