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

combobox text

P: n/a

I have a combobox that is bound to a list of text and values in a dataset.
It is in Dropdown mode - which enables the user to type in their own text if
they so wish. when I process the form, I check the Selected value property,
if it is 0 (not one of my bound values) then I know to add their new item to
my database using the combobox.Text property (after prompting them with a
few questions) .

I want to programatically set the text of the combobox with a suggested
value not in the bound list, like so:

myComboBox.Text = "NewText"

but when I check the Text property of the combobox I get the first value in
the bound dataset - even though I can see the text has been correctly set in
the form.(unlike when the user manually types in some new text).

Is there something else I can do?


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

P: n/a
You can add the text/record to the datasource the ComboBox is bound to then
make sure to handle the extra row in your code as to not push it back when
updating the database.

For example, if your ComboBox is bound to a DataTable add the row before
filling it and it will show up as the first record in the ComboBox.

Steve Stein
VB Team
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.