Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
10
Reply
How to display two different columns in one combobox c#
Jyoti Jodha
Sep 21 2017 7:37 AM
300
Reply
How to display two different columns in one combobox windows form c#
DataRow dr;
con.Open();
SqlCommand cmd = new SqlCommand("select Product_ID,Name,Bar_Code from Product", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
dr = dt.NewRow();
dr.ItemArray = new object[] { 0, "--Select Product--" };
dt.Rows.InsertAt(dr, 0);
comboBoxproduct.ValueMember = "Product_ID";
comboBoxproduct.DisplayMember = "Name" or "Bar_Code";
comboBoxproduct.DataSource = dt;
con.Close();
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
10
)
Next Recommended Forum
Please my datagridview is blinking in c# windows form
Illegal characters in path in windows form c#