Answer the question
In order to leave comments, you need to log in
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
Well, without seeing the code, it’s impossible to say for sure, try using the debugger
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 questionAsk a Question
731 491 924 answers to any question