且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何向未绑定的DataGridView添加一行?

更新时间:2023-12-06 17:28:40

我通常会用其他人提供的答案这不是这样,因为答案并不真正有用。

I usually go with answers provided by other people but this is not the case since the answers aren't really helpful.

正如我所说dataGridView1.Rows.Add();抛出异常,AddRange也是如此。

我做了很多检查后发现了答案。显然,如果我添加了很多行/秒(约30),则不喜欢它。

我通过网络接收我的行,所以我创建了一个行池,每隔一秒我更新了datagridview。

这似乎已经修复了没有显示的行和异常。

As I stated "dataGridView1.Rows.Add();" threw an exception and so did AddRange.
I found out the answer after doing a lot of checks. Apparently .Net does not like it if I add a lot of rows/second (about 30).
I receive my rows via networking so I created a pool of rows and every second I updated the rows from the datagridview.
This seems to have fixed both the rows not showing up and the exceptions.

感谢您的输入!