Загрузка...

How do I get an int array with a GridView?

Thread in C# created by Evgeny112 Jul 22, 2020. 116 views

  1. Evgeny112
    Evgeny112 Topic starter Jul 22, 2020 35 Feb 18, 2017
    Добрый вечер!
    Такая проблема записываю данные с dataGridView1 в myArray[i, j], но это объект а мне надо в обычный массив int что бы сравнивать значения ячеек.
    вопрос как это сделать.
    Code
    object[,] myArray = new object[dataGridView1.RowCount, dataGridView1.ColumnCount];
    for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
    {
    for (int j = 0; j < dataGridView1.Columns.Count; j++)
    {
    myArray[i, j] = dataGridView1.Rows[i].Cells[j].Value.ToString();
    }
    }
    P.S. Не шарю HELP
     
  2. Neker_inactive3439379
    Evgeny112,
    myArray[i, j] = Convert.ToInt32(dataGridView1.Rows.Cells[j].Value);
     
    1. Evgeny112 Topic starter
Top
Loading...