H
H
hidden_pingvin2014-04-21 22:27:26
.NET
hidden_pingvin, 2014-04-21 22:27:26

C# - Why does the program hang and crash when adding a new row to the DataGridView?

I read XML and enter the read data into the DataGridView, after I count the first Node and enter it into the control line, the line should be executed this.dataGridView1.Rows.Add();
. But at this moment the program freezes and crashes after a few seconds.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pigah, 2014-04-21
@pigah

Well, without seeing the code, it’s impossible to say for sure, try using the debugger

H
hidden_pingvin, 2014-04-22
@hidden_pingvin

Using try-catch got an exception: "Rows cannot be programmatically added to the DataGridView's collection of rows if the control is data bound." So I understand when data is entered there, it is impossible to add a new line. But I tried to put the addition of a line at the very beginning of the Form_Load method, and the program still crashes at this place. Maybe I'm somehow adding lines incorrectly? Or is it necessary to initialize the type of each cell?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question