Событие change в Combobox
Модератор: Naeel Maqsudov
В создаваемой программе имеется Combobox со списком фамилий: Иванов Игнатьев Козлов Петров Петрищев... Я хотел бы, чтобы по мере ввода букв в этом Combobox'е сразу появлялась ближайшая фамилия, т.е. при наборе букв ив должна появляться фамилия: Иванов, при наборе иг - Игнатьев и т.д. У меня же фамилия появляется только после введения всего слова. В моем случае в событии change я использовал конструкцию Select Case.
Точно не знаю, но посмотри свойство MatchEntry у Combobox. У него 3 свойства:
- 0-fmMatchEntryFirstLetter - Basic matching. The control searches for the next entry that starts with the character entered. Repeatedly typing the same letter cycles through all entries beginning with that letter.
- 1-fmMatchEntryComplete - Extended matching. As each character is typed, the control searches for an entry matching all characters entered (default).
- 2-fmMatchEntryNone - No matching.
Вам, наверное, нужна вторая из них, а именно 1-fmMatchEntryComplete
- 0-fmMatchEntryFirstLetter - Basic matching. The control searches for the next entry that starts with the character entered. Repeatedly typing the same letter cycles through all entries beginning with that letter.
- 1-fmMatchEntryComplete - Extended matching. As each character is typed, the control searches for an entry matching all characters entered (default).
- 2-fmMatchEntryNone - No matching.
Вам, наверное, нужна вторая из них, а именно 1-fmMatchEntryComplete
Возможно я бы и попробовал этот вариант, но у меня чистый VB, а это VBA.Pavel55 писал(а):Точно не знаю, но посмотри свойство MatchEntry у Combobox. У него 3 свойства:
- 0-fmMatchEntryFirstLetter - Basic matching. The control searches for the next entry that starts with the character entered. Repeatedly typing the same letter cycles through all entries beginning with that letter.
- 1-fmMatchEntryComplete - Extended matching. As each character is typed, the control searches for an entry matching all characters entered (default).
- 2-fmMatchEntryNone - No matching.
Вам, наверное, нужна вторая из них, а именно 1-fmMatchEntryComplete
-
- Сообщения: 526
- Зарегистрирован: 04 фев 2007, 18:37
- Откуда: Сургут
- Контактная информация:
Здравствуйте kminas.
Подключите библиотеку Microsoft Forms 2.0 (FM20.DLL), его ComboBox имеет свойство MatchEntry
я знаю VB6.0, VBNET, а "Чистый" ?
Евгений
Подключите библиотеку Microsoft Forms 2.0 (FM20.DLL), его ComboBox имеет свойство MatchEntry
я знаю VB6.0, VBNET, а "Чистый" ?

Евгений
Teslenko_EA, когда пришел на форум, впитал, что читал. Чистым зовут VB (в отличие от VBA). Раньше так величали VB6.0, а сейчас, возможно и VBNET.
Константин
Константин
- Aent
- Сообщения: 1129
- Зарегистрирован: 01 окт 2006, 14:52
- Откуда: Saratov,Russia
- Контактная информация:
Подключать FM20.dll для отчуждаемого проекта несколько неосмотрительно ...
А вдруг на целевой машине офис не будет установлен ...
Посмотрите лучше это http://support.microsoft.com/kb/154076
А вдруг на целевой машине офис не будет установлен ...

Посмотрите лучше это http://support.microsoft.com/kb/154076
Спасибо, буду пользоваться! А эту проблему за меня решили на одном из форумов:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
SendMessage Me.Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
End Sub
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
SendMessage Me.Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
End Sub