I think you should create a table then
create the desired columns and associated it with the table then add the row for example like the below code
Code://add a datagridview to your code -> dataGridView1 DataTable tabel; DataColumn nameColmn; DataColumn mobileNoColmn; DataColumn homeNoCol; DataColumn workNoCol; DataColumn emailColmn; tabel = new DataTable(); nameColmn = tabel.Columns.Add("Name"); homeNoCol = tabel.Columns.Add("Home"); mobileNoColmn = tabel.Columns.Add("Mobile"); workNoCol = tabel.Columns.Add("Work"); emailColmn = tabel.Columns.Add("Email"); //associate the tabel with datagrid view dataGridView1.DataSource = tabel.DefaultView; create the row to add DataRow row = tabel.NewRow(); row[nameColmn] = "Falco Eyes"; row[homeNoCol] = "123456"; row[mobileNoColmn] = ""; row[workNoCol] = ""; row[emailColmn] = "[email protected]"; tabel.Rows.Add(row);




Reply With Quote