JamesBowtell
Member
- Joined
- Feb 26, 2009
- Messages
- 16
- Programming Experience
- 3-5
Hey
i have a form that contains a DataGrid that displays information about a user.
I'm getting an error every time i click a header on this data grid but i dont know why.
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
what the above code does is select the users id from the users column and sets a variable with that value.
i'm using Visual Basic 2008 express, is there anyway of stopping users being able to click the headers in a datagrid. I have set AllowUsersToResizeColumns to False
any ideas ?
thanks
i have a form that contains a DataGrid that displays information about a user.
I'm getting an error every time i click a header on this data grid but i dont know why.
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
VB.NET:
Public Sub Tbl_userDataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Tbl_userDataGridView.CellClick
NuNameTB = Me.Tbl_userDataGridView.Rows(e.RowIndex).Cells("DataGridViewTextBoxColumn1").Value
Me.DialogResult = Windows.Forms.DialogResult.OK
Me.Close()
End Sub
what the above code does is select the users id from the users column and sets a variable with that value.
i'm using Visual Basic 2008 express, is there anyway of stopping users being able to click the headers in a datagrid. I have set AllowUsersToResizeColumns to False
any ideas ?
thanks