Datagridview Combobox

barski

Junior Contributor
Joined
Apr 7, 2002
Messages
240
Location
Tennessee
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.
 
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?
 
Last edited:
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.
 
Back
Top