Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>finally i got the answer...</p> <p>private void BTN_ADD_Click(object sender, EventArgs e) { int j=0;</p> <pre><code> DataGridViewComboBoxCell ColumnItem2 = new DataGridViewComboBoxCell(); // create a combobox cell ColumnItem2.ValueMember = "Display"; ColumnItem2.DisplayMember = "Display"; for(int i=0;i&lt;10;i++)// it will add elements to a combox { ColumnItem2.Items.Add(i); } dataGridView1.Rows.Add(); // add row everytime to add a new combobox to the next row. int columncount = dataGridView1.ColumnCount;// count no of coloumns int rowcount = dataGridView1.RowCount;;// count no of rows </code></pre> <p>//i kept count no of columns and rows so that by rows and columns count u can specify to which row or you want to add combobox inside gridview // below i hard coded the combobox row and column to 2,2 so it will add a combobox to 2nd row and 2nd column.</p> <pre><code> dataGridView1[2, 2] = ColumnItem2; //dataGridView1[2, j] = ColumnItem2; </code></pre> <p>// general way of adding combox to second column and row is everytime added by one as i m incrementing j value every time to each time on button click it will add combox on next row on second column..same way you can specify row and column as per your need.</p> <p>j++;</p> <p>}</p> <p>hope this will help others....</p> <p><a href="http://csharpprobsandsoln.blogspot.in/2013/04/how-to-add-combobox-dynamically-to.html" rel="nofollow">http://csharpprobsandsoln.blogspot.in/2013/04/how-to-add-combobox-dynamically-to.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload