I am trying to add data to an existing gridview, the gridview already has defined columns and I need to add data to these columns.
However when I use gridview.dataso urce, it just adds new columns to the gridview. It is properly not that hard to do this, but I have been hammering my head on this problem for the last three days and I haven’t been able to find any help on Google.
I have added the code I have already made and it works ok, it just adds new columns instead of putting the data in the existing columns.
However when I use gridview.dataso urce, it just adds new columns to the gridview. It is properly not that hard to do this, but I have been hammering my head on this problem for the last three days and I haven’t been able to find any help on Google.
I have added the code I have already made and it works ok, it just adds new columns instead of putting the data in the existing columns.
Code:
private void GridViewFunktion()
{
DataColumn colOrigName = new DataColumn("Original_Name");
DataColumn colNr = new DataColumn("Nr");
DataColumn colSystem_Hop = new DataColumn("System_Hop");
DataColumn colType = new DataColumn("Type");
myTable.Columns.Add(colOrigName);
myTable.Columns.Add(colNr);
myTable.Columns.Add(colSystem_Hop);
myTable.Columns.Add(colType);
varStringedt = OtherFunktions.VARSTRINGEDT;
for (int i = 0; i < varStringedt.Length; i++)
{
DataRow myRow;
myRow = myTable.NewRow();
myRow["Original_Name"] = varStringedt[i];
myTable.Rows.Add(myRow);
}
ReMk1_SE_dataGridView.DataSource = myTable;
}
Comment