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

combobox selected no highlight

tab next control , highlight shows

tab next control , highlight shows

ctrl+tab initial combobox, hightlight 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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -