Hello,
I have an application that allows user to add a new record in a datagrid view for a list of users; small table.
I check to see if the user 'forgot' to add certain fields required by my program. If they forgot the field I write a default value for them. The situation is this:
1. I ADD a new record
2. The user is entered just fine while leaving out these two fields that I'm checking for.
3. This code errors out telling me that:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll. Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
I sure hope that you can help me!
Dim x
x = Log_In_CredentialsDataGridView.SelectedRows(0).Cells(5).Value.ToString
If x = "" Then Log_In_CredentialsDataGridView.SelectedRows(0).Cells(5).Value = 5
Dim y
y = Log_In_CredentialsDataGridView.SelectedRows(0).Cells(6).Value.ToString
If y = "" Then Log_In_CredentialsDataGridView.SelectedRows(0).Cells(6).Value = 0
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.