Problem clearing the text in a combobox

  • Thread starter Stephen Robertson
  • Start date
S

Stephen Robertson

using vb.net:

I have some comboboxes that are bound:

..DataSource = dstPerson.Tables("postype")
..DisplayMember = "type"
..ValueMember = "postype_id"
..DataBindings.Add("SelectedValue", dstPerson.Tables("person"),
"postype_id")

The combos DropDownStyles are set to dropdown so the user can blank
out a selection.

When a combo's text is cleared and a save button is clicked
(.AcceptChanges is called on the dataset), the text returns.
Although, if I load the data again, it is blank.

Any ideas on how to clear the text?


Stephen Robertson
 
Y

Ying-Shen Yu[MSFT]

Hi Stephen,

Do you mean How to clear the text of current selected item using ComboBox?

If you mean, selecting a certain item, clear the text area of the ComboBox
then save, to update the display text of selected item to empty. You need
bind the Text property to
the "type" column.

If you just mean clear the selection of the ComboBox, you may try adding
comboBox1.SelectedBox = -1;
comboBox1.SelectedBox = -1;
after AcceptChanges();

Does this resolve your problem?
If you still have problem on this issue, please feel free to let me know.
Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top