Resolved DataGridView.RowCount = 2 causing InvalidCastingException

pizzaboy

Well-known member
Joined
Jan 5, 2008
Messages
57
Programming Experience
1-3
Why am I getting an InvalidCastingException at the ".RowCount = 2" line?

Private Sub frmTesting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With DataGridView1
.RowCount = 2
.Item(0, 0).Value = 1
.Item(1, 0).Value = "testing1"
.Item(0, 1).Value = 2
.Item(1, 1).Value = "testing2"
End With
End Sub


Any help would be greatly appreciated.

Thanks.
 
Last edited:

Latest posts

Back
Top