我有一个DataGridView我正在以编程方式添加行。
通常,当我添加第一行数据时,SelectionChanged事件会触发
但是我的 Grid 锚定在表单的顶部和底部,当我使表单变小以使 Grid 的高度为零SelectionChanged时,添加第一行时不会触发事件。
这是设计使然吗?这对我来说似乎不合逻辑。
With DataGridView1
.Rows.Clear()
.Columns.Clear()
.Columns.Add("Col1", "Col1")
.Columns.Add("Col2", "Col2")
'uncomment the following line and the SelectionChanged event does not fire
'.Height = 0
.Rows.Add("foo", "bar")
End With