Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add "Select" in a combobox

Status
Not open for further replies.

pinkpoppy

Programmer
Jul 6, 2011
75
US
I have a combobox in a window form and it is populating from a datasource via sql. I need a blank item, "select category". How do I do it?

Code:
                dtCategory = SQLQuery("Select Category Display from Category_Support").Tables[0];
                DataColumn[] CategoryKeyColumn = new DataColumn[1];
                CategoryKeyColumn[0] = dtCategory .Columns[0];
                combobox1.DataSource = dtCategory ;
                combobox1.DisplayMember = "Display";
                combobox1.ValueMember = "Display";
 
Maybe this:

Code:
Select 'Select Category' As Display Union All Select Category from Category_Support


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top