Как заполнить dataGridView из .txt файла?
Есть четыре столбца: Название товара, цена, количество, наличие. Последний столбец с типом столбца DataGridViewCheckBoxColumn. Как можно реализовать это заполнение?
StreamReader^ sr = gcnew StreamReader("products_1.txt");
array<wchar_t>^ splitBy = { ' ' };
array<Double>^ numbers = gcnew array<Double, 1>(4);
for (;;) {
String^ line = sr->ReadLine();
if (line == nullptr) break;
if (line->Length > 0) {
cli::array<String^>^ parts = line->Split(splitBy, StringSplitOptions::RemoveEmptyEntries);
int rowIndex = dataGridView1->Rows->Add();
dataGridView1->Rows[rowIndex]->Cells[0]->Value = double::Parse(parts[0]);
dataGridView1->Rows[rowIndex]->Cells[1]->Value = double::Parse(parts[1]);
dataGridView1->Rows[rowIndex]->Cells[3]->Value = double::Parse(parts[3]);
dataGridView1->Rows[rowIndex]->Cells[4]->Value = double::Parse(parts[4]);
}
}