KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I had a combobox in a Windows Forms form which retrieves data from a database. I did this well, but I want to add first item <-Please select Category-> before the data from the database. How can I do that? And where can I put it? public Category() { InitializeComponent(); CategoryParent(); } private void CategoryParent() { using (SqlConnection Con = GetConnection()) { SqlDataAdapter da = new SqlDataAdapter("Select Category.Category, Category.Id from Category", Con); DataTable dt = new DataTable(); da.Fill(dt); CBParent.DataSource = dt; CBParent.DisplayMember = "Category"; CBParent.ValueMember = "Id"; } }
Tags (comma-separated)
Save Edits
Cancel