Question Add Item To Databound ComboBox

posix32

Member
Joined
Apr 20, 2009
Messages
13
Programming Experience
1-3
This may seem like a silly question, but i'm really stuck on this.

Short story of how I got to situation first. I started a Windows app using all code for database connection and validation. However, it was always losing the formatting that I had set at run time. So I thought I would use the long tedious process of using all of the studios objects with minimum code.

I am now at the position where I am mostly happy with the layout and how this operates. However, I want to be able to add a non-databound value to a databound combo box. I have set the properties for the combo box in the combo box tasks.

Also, I want to add the ability for the user to update that table that is bound to this control, when a value is not in the list. I know that there is a NotInList event in Access, but I can not find it in VB.Net. I did get so far with updating from the combo box using the Leave event. However, when the database was updated the control could not find the ID in the Clients table to save to the Quotes table.

Any help on this would be great!!!

Thank you in advance!!! :D
 
Whether you can do this depends to some extent on how you are binding the data for your ComboBox if you are using an SQL SELECT statement you can do something like:
VB.NET:
select '<--Select-->' as UserName union all
select distinct(UserName)  as UserName  from Users
order by UserName

but otherwise I do not know a way.

Hope this helps. :)

I have just found this article which claims to allow what you want to do, I haven't tried it!. CodeProject: Unbound items in a bound ComboBox. Free source code and programming help
 
Last edited:
Back
Top