Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Locating start in a combobox
#1
A long alphabetical list is to be stored and accessed through a read-only combobox. I need to locate the starting letter in the list to avoid tiresome pull-down actions. I wonder whether there exists something simpler than what I use. Any advice is much appreciated.

Function Dialog45
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 183 136 "Dialog"
;3 ComboBox 0x54230243 0x0 33 23 96 212 ""
;6 Edit 0x54030080 0x200 95 7 17 12 ""
;4 Static 0x54000000 0x0 6 7 85 12 "Select Combo Start"
;1 Button 0x54030001 0x4 34 43 48 14 "OK"
;2 Button 0x54030000 0x4 88 43 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040500 "*" "" "" ""

str controls = "3 6"
str cb3 e6

cb3=
;apple
;cat
;class
;dog
;key
;lamp
;paper
;road
;star
;table
;tree
;unix
;victory
;water
;xenon
;yard
;zebra

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [EN_CHANGE<<16|6]
,_s.getwintext(id(6 hDlg))
,CB_SelectString(id(3 hDlg) _s)

,case IDOK
,case IDCANCEL
ret 1
#2
I think this is simple to create and simple to use.
#3
Code:
Copy      Help
private void findButton_Click(object sender, System.EventArgs e) {
    int index = comboBox1.FindString(textBox2.Text);
    comboBox1.SelectedIndex = index;
}


Forum Jump:


Users browsing this thread: 1 Guest(s)