Adding rows on datagridview manually
c#, winforms
Solution
You can pass an object array that contains the values which should be inserted into the `DataGridView` in the order how the columns are added. For instance you could use this:
dataGridView1.Rows.Add(new object[] { true, "string1" });
dataGridView1.Rows.Add(new object[] { false, "string2" });
And you can build object array from whatever you want, just be sure to match the type (i.e. use bool for checkedColumn)
Problem
I've inserted a checkbox column and textbox column on the datagridview. how can add rows manually on the textbox column. It should be like this: ``` checkbox | textbox ............................ checkbox | item1 checkbox | item2 checkbox | item3 checkbox | item4 ``` Here is the code for checkbox and textbox on datagridview ``` public void loadgrid() { DataGridViewCheckBoxColumn checkboxColumn = new DataGridViewCheckBoxColumn(); CheckBox chk = new CheckBox(); checkboxColumn.Width = 25; dataGridView1.Columns.Add(checkboxColumn); DataGridViewTextBoxColumn textboxcolumn = new DataGridViewTextBoxColumn(); TextBox txt = new TextBox(); textboxcolumn.Width = 150; dataGridView1.Columns.Add(textboxcolumn); } ```