SchoolTeacher54
asked on
Writing a value to a datagrid
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.ArgumentOutOfRange Exception' 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_CredentialsDataGrid View.Selec tedRows(0) .Cells(5). Value.ToSt ring
If x = "" Then Log_In_CredentialsDataGrid View.Selec tedRows(0) .Cells(5). Value = 5
Dim y
y = Log_In_CredentialsDataGrid View.Selec tedRows(0) .Cells(6). Value.ToSt ring
If y = "" Then Log_In_CredentialsDataGrid View.Selec tedRows(0) .Cells(6). Value = 0
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.ArgumentOutOfRange
I sure hope that you can help me!
Dim x
x = Log_In_CredentialsDataGrid
If x = "" Then Log_In_CredentialsDataGrid
Dim y
y = Log_In_CredentialsDataGrid
If y = "" Then Log_In_CredentialsDataGrid
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.