Hi Timo
Let's say i have combobox and some items on it;
Adnrea
Berta
Inga
Timo
Thomas
When the combobox is in focus and i start typing, T (Timo is selected), I (Inga is selected)
Is is possible to disable this feature? What i want is when T and then I is pressed, Timo is still selected and not Inga
BR;
Meelis
Find&Select
Re: Find&Select
Windows doesn't support this feature, but it should be possible to implement it yourself, based on the SelectItemByText method, the KeyPress event and a timer.
Something like this:
Dim s As String
On Combo_KeyPress: s = s & Chr(keyAscii), SelectItemByText(s, False), reset/start timer
On Timer: s = ""
TiKu
Something like this:
Dim s As String
On Combo_KeyPress: s = s & Chr(keyAscii), SelectItemByText(s, False), reset/start timer
On Timer: s = ""
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Find&Select
i want auto complete, but i dont know, can u help me?
sorry, my english bad
thanks
sorry, my english bad
thanks
Re: Find&Select
Hi,
what kind of auto-complete do you need? Do you want to display filesystem paths and provide auto-completion like the "Run" dialog of Microsoft Windows? This can be achieved with the SHAutoComplete API function.
Or do you want to provide auto-completion where the rest of the word is inserted into the edit field and highlighted automatically?
TiKu
what kind of auto-complete do you need? Do you want to display filesystem paths and provide auto-completion like the "Run" dialog of Microsoft Windows? This can be achieved with the SHAutoComplete API function.
Or do you want to provide auto-completion where the rest of the word is inserted into the edit field and highlighted automatically?
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Find&Select
To provide the second type of auto-completion try this code:
Code: Select all
Option Explicit
Dim m_enteredText As String
Private Sub ComboBox1_KeyDown(keyCode As Integer, ByVal shift As Integer)
Dim cbi As ComboBoxItem
If keyCode = vbKeyReturn Then
ComboBox1.SetSelection Len(ComboBox1.Text), -1
ElseIf keyCode = vbKeyBack Then
If Len(m_enteredText) > 1 Then
m_enteredText = Left$(m_enteredText, Len(m_enteredText) - 1)
Set cbi = ComboBox1.FindItemByText(m_enteredText, False)
If Not (cbi Is Nothing) Then
ComboBox1.Text = cbi.Text
ComboBox1.SetSelection Len(m_enteredText), Len(ComboBox1.Text)
End If
keyCode = 0
Else
ComboBox1.Text = ""
End If
End If
End Sub
Private Sub ComboBox1_TextChanged()
Dim cbi As ComboBoxItem
m_enteredText = ComboBox1.Text
Set cbi = ComboBox1.FindItemByText(m_enteredText, False)
If Not (cbi Is Nothing) Then
ComboBox1.Text = cbi.Text
ComboBox1.SetSelection Len(m_enteredText), Len(ComboBox1.Text)
End If
End Sub
Private Sub Form_Load()
With ComboBox1.ComboItems
.Add "This is item 1"
.Add "Followed by item 2"
.Add "To auto-complete"
.Add "Type into the edit field"
.Add "The control does not"
.Add "Support auto-completion"
.Add "Out of the box"
End With
m_enteredText = ""
End Sub
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Find&Select
thanks, it run good
orther question. i use event TextChanged but when load data to textbox it not change.
what do i need use event? i try use all event but not change
orther question. i use event TextChanged but when load data to textbox it not change.
what do i need use event? i try use all event but not change