I'm translating an old VB routine to C#. In VB I had the following code sequence
I put the VB code thru an on-line translator and this is what came back
The C# code compiles without error, but when it runs as soon as it executes the "keys(0) = nThisShiftGroup;" line it throws the following error:
What am I not doing?
Steve
Code:
Dim SearchView AS New DataView(CurrentSchedule.Tables(0))
SearchView.Sort = "shiftgroup,worker_id"
SearchView.RowFilter = "worker_id <> 0"
Dim keys(1) as Object
...
' Set lookup values for this record.
keys(0) = nThisShiftGroup
keys(1) = nWorkerId
I put the VB code thru an on-line translator and this is what came back
Code:
DataView SearchView = new DataView(CurrentSchedule.Tables[0]);
SearchView.Sort = "shiftgroup,worker_id";
SearchView.RowFilter = "worker_id <> 0";
object[,] keys = null;
...
// Set lookup values for this record.
keys(0) = nThisShiftGroup;
keys(1) = nWorkerId;
The C# code compiles without error, but when it runs as soon as it executes the "keys(0) = nThisShiftGroup;" line it throws the following error:
Code:
Object reference not set to an instance of an object
What am I not doing?
Steve