עבור לתוכן

c# - מעבר בין מערך דו מימדי ל- DATAGRIDViEW

Featured Replies

פורסם

שלום,

יש לי נתונים במערך דו מימדי.

איך אני מציג אותם בDATAGRIDVIEW בטופס?

אשמח לקבל קטע קוד קצר וקולע.

תודה

פורסם
    public void arrayToDatagridview(string[,] array2, DataGridView DataGridView1)
{
for (int x = 0; x < array2.GetLength(0); x++)
{
DataGridView1.Columns.Add("", x.ToString());
}
for (int y = 0; y < array2.GetLength(1); y++)
{
DataGridView1.Rows.Add();
for (int x = 0; x < array2.GetLength(0); x++)
{
DataGridView1[x, y].Value = array2[x, y];
}
}
}

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים