barski Posted October 15, 2010 Posted October 15, 2010 Is there now way to add items without setting the datasource of the combobox? i'm very confused by this it would seem to me that there should be a way to comboboxColumn.Items.Add(value,display) but every example i see has datasource=sometable displaymember= column1Name valueMemeber = column2Name any help would be appreciated. for now i'll just create a table and bind it since that's the only way i can get it to work. Quote
Pharean Posted January 10, 2011 Posted January 10, 2011 (edited) Try this: Create a new winform and add a combobox in designer. Then go to code and add this: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace quick_test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string example = "This is an example"; comboBox1.Items.Add(example); } } } Is this what you mean? Edited January 10, 2011 by Pharean Quote
devTastic Posted February 2, 2011 Posted February 2, 2011 I think what he meant was that he has a datagridview where one of the columns is of type combobox. Barski: I don't believe what you are asking for is possible. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.