0
下面的代码应搜索DataGridView1
这是LeaderAccessTable
形式为整数的用户投入SendFromID
,如果DataGridView1
的第一列包含哪些用户已进入SendFromID
整数那么应该选择整个行。但它根本不会选择任何行......任何人都可以看到为什么?此代码从单独的表单运行。搜索的DataGridView然后选择行
Dim intcount As Integer
For Each Row As DataGridViewRow In LeadersAccessTable.DataGridView1.Rows
If LeadersAccessTable.DataGridView1.Rows(intcount).Cells(0).Value.ToString = SendFromID.Text Then
LeadersAccessTable.DataGridView1.Rows(intcount).Selected = True
End If
Next
MsgBox("Done.")
这可能是一个问题,你没有引用表单的实例的数据不是{formname}。{controlname}引用 - 这是合法的调用,但不会让你在哪里。 – OneFineDay