G
Guest
I have a datagrid and want to identify the primary key. Each time I try I
get an error
System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name: index
The code I am using seems straight forward enough.
Private Sub DG_Glossary_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles DG_Glossary.SelectedIndexChanged
Dim IDIndex As Integer
Dim IDKey As Integer
IDIndex = DG_Glossary.SelectedIndex
IDKey = DG_Glossary.DataKeys(IDIndex)
.............
end sub
IDIndex calculates fine but IDKey causes an error.
get an error
System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name: index
The code I am using seems straight forward enough.
Private Sub DG_Glossary_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles DG_Glossary.SelectedIndexChanged
Dim IDIndex As Integer
Dim IDKey As Integer
IDIndex = DG_Glossary.SelectedIndex
IDKey = DG_Glossary.DataKeys(IDIndex)
.............
end sub
IDIndex calculates fine but IDKey causes an error.