Я получаю ошибку при вводе данных в ячейку таблицы данных. Код ошибки: StackTrace:
at System.Windows.Forms.BindingSource.get_Count()
at System.Windows.Forms.DataGridViewCell.SetValue(Int32 rowIndex, Object value)
at :line 1633
at System.Threading.Tasks.Task.Execute()
Строка 1633: TableGridview1.Rows [i] .Cells [21] .Value = teknikresimim;
Должен ли я связываться снова после каждого обновления ячеек?
for (int i = 0; i < TableGridview1.Rows.Count; i++)
{
#region kolon_adi tanimla
string parcano_kolon = Convert.ToString(TableGridview1.Rows[i].Cells[1].Value);
string rev_kolon = Convert.ToString(TableGridview1.Rows[i].Cells[2].Value);
string op1_kolon = Convert.ToString(TableGridview1.Rows[i].Cells[13].Value);
string dwgyolu_kolon = Convert.ToString(TableGridview1.Rows[i].Cells[23].Value);
string pdfyolu_kolon = Convert.ToString(TableGridview1.Rows[i].Cells[24].Value);
string dizinler = Convert.ToString(TableGridview1.Rows[i].Cells[25].Value);
string sirano = Convert.ToString(TableGridview1.Rows[i].Cells[38].Value);
#endregion
string pdfim = null;
string teknikresimim = null;
string dwg_kontrol = null;
var taskList = new List<Task>
{
Task.Factory.StartNew(() =>
{
pdfim = PDFdir(parcano_kolon, dizinler, rev_kolon, sirano);
TableGridview1.Rows[i].Cells[22].Value = pdfim;
TableGridview1.UpdateCellValue(22, i);
}),
Task.Factory.StartNew(() =>
{
teknikresimim = TeknikDir(parcano_kolon, dizinler)[0];
TableGridview1.Rows[i].Cells[21].Value = teknikresimim;
TableGridview1.UpdateCellValue(21, i);
}),
Task.Factory.StartNew(() =>
{
dwg_kontrol = DwgBul(parcano_kolon, rev_kolon, op1_kolon, sirano)[0];
TableGridview1.Rows[i].Cells[20].Value = dwg_kontrol;
TableGridview1.UpdateCellValue(20, i);
})
};
Task.WaitAll(taskList.ToArray());
}