I am using access 07 and c#.net 2005.
I have a datagridview which has one combo box column.
I want to insert values in the combo box.
however the value of combo box in each row will be different.

comboboxcolumnname.Items.Add(value)

using this code i can add values to combobox column of every row.
but I want to add value to only one of the rows of the datagridview combo box..

Handles RowEnter event,

....
dataGridView1.RowEnter += new DataGridViewCellEventHandler(dataGridView1_RowEnter);
}

void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == 0)
 ((DataGridViewComboBoxCell)dataGridView1.Rows[e.RowIndex].Cells[0]).DataSource = new string[] { "1", "2", "3" };
            if (e.RowIndex == 1)
                ((DataGridViewComboBoxCell)dataGridView1.Rows[e.RowIndex].Cells[0]).DataSource = new string[] { "11", "21", "23" };
            if (e.RowIndex == 2)
                ((DataGridViewComboBoxCell)dataGridView1.Rows[e.RowIndex].Cells[0]).DataSource = new string[] { "a1", "a2", "a3" }; 
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.