By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

UserControl hangs on to SelectedText

P: n/a
A user control with
1 combobox
1 button
has a default constructor.
The control has public properties to set the combobox
Datasource, DisplayMember and ValueMember properties.
These are set in the Forms Load event handler.

The combo box control has its text selected even though
it doesnt have focus when the form displays.
I've been looking for something I've done to cause this
but with no luck so far. Any ideas?

Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Ok, i found this after a day of headaches. Wanted to post the cause/cure in case anyone else runs into this

The combo box is being sized based on the visibility of the button.
When the user control initializes it makes the button visible which resizes the combobox
*resizing causes the text to become selected
After the entire form loads, the combo box no longer has focus BUTshows its text as selected

I'm showing/hiding the button based on user permissions as the form is loaded. After resizing the combobo
in the buttons visible changed event I just added the statement: combobox1.selecttext(999,0)

Now its all good.
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.