-1

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..

2
Contributors
1
Reply
6
Views
7 Years
Discussion Span
Last Post by __avd
0

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" }; 
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.