vb.net - ComboBox doesn't highlight when selected programmatically -
vb.net 2012
i have 2 comboboxes dropdownstyle of dropdownlist. selecting 1 of comboboxes when form loads, cbomybox.select(). problem when select (or focus, or selectall) combobox programmatically doesn't show dotted line highlight. when tab between controls dotted line highlight shows fine. filling combobox data before selecting it.
how can dotted line highlight show when select control in code?
combobox selected in code no highlight
tab next control , highlight shows
ctrl+tab initial combobox, hightlight shows
i have done experiments , seems once have tabbed control combo box or text box , later use select() or focus() method, select box (dotted rectangle) appears in combo boxes; if didn't tab of them previously.
the trick tab controls sendkeys when form opens.
private sub form1_shown(sender object, e eventargs) _ handles form1.shown ' select control preceding combo box in tab order. textbox1.select() sendkeys.sendwait("{tab}") sendkeys.sendwait("{tab}") ' select fist control selected when form opens. btnfocus.select() end sub it works if tab key sent twice (don't ask me why, maybe timing issue).



Comments
Post a Comment