Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: nested classes Pin
Keith Barrow11-Sep-13 2:17
professionalKeith Barrow11-Sep-13 2:17 
GeneralRe: nested classes Pin
Member 1026649411-Sep-13 3:13
Member 1026649411-Sep-13 3:13 
GeneralRe: nested classes Pin
Dave Kreskowiak11-Sep-13 4:54
mveDave Kreskowiak11-Sep-13 4:54 
GeneralRe: nested classes Pin
NotPolitcallyCorrect11-Sep-13 2:41
NotPolitcallyCorrect11-Sep-13 2:41 
AnswerRe: nested classes Pin
V.11-Sep-13 3:20
professionalV.11-Sep-13 3:20 
AnswerRe: nested classes Pin
Richard MacCutchan11-Sep-13 6:19
mveRichard MacCutchan11-Sep-13 6:19 
QuestionHow can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
babak1411-Sep-13 1:33
babak1411-Sep-13 1:33 
AnswerRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
OriginalGriff11-Sep-13 2:31
mveOriginalGriff11-Sep-13 2:31 
At a guess - and that's about it it can be from that little code - you haven't allocated any rows or columns in the destination DGV, or you are trying to access different sized DGVs.
So when you try to access it's Rows collection via an index:
C#
Finaldgv.Rows[RowNo]
Or the resulting DataGridViewRow Cells collection:
C#
Finaldgv.Rows[RowNo].Cells[CellNo]
It complains becasue it doesn't exist.

Start this way: put a breakpoint on the if line, and single step through from there - look at the variables as you go, and look for null values. (It may help to "break out" the line assigning the row so that each part to the left of a "." is a separate variable - you don't need to, but it makes it easier to see without complex use of the debugger)
C#
DataGridViewRow row = Finaldgv.Rows[RowNo];
DateGridViewCell cell = row.Cells[CellNo];
And so forth.

PS: Keep an eye on the value of i...
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre.
Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.

AnswerRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
Keith Barrow11-Sep-13 2:40
professionalKeith Barrow11-Sep-13 2:40 
GeneralRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
babak1411-Sep-13 5:27
babak1411-Sep-13 5:27 
GeneralRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
Pete O'Hanlon11-Sep-13 5:38
mvePete O'Hanlon11-Sep-13 5:38 
GeneralRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
babak1411-Sep-13 5:53
babak1411-Sep-13 5:53 
GeneralRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
Pete O'Hanlon11-Sep-13 6:31
mvePete O'Hanlon11-Sep-13 6:31 
GeneralRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
babak1411-Sep-13 7:25
babak1411-Sep-13 7:25 
GeneralRe: How can I solve thiss error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" Pin
Pete O'Hanlon11-Sep-13 7:55
mvePete O'Hanlon11-Sep-13 7:55 
Questionreading table from csv Pin
Member 1026649411-Sep-13 0:17
Member 1026649411-Sep-13 0:17 
AnswerRe: reading table from csv Pin
Pete O'Hanlon11-Sep-13 3:37
mvePete O'Hanlon11-Sep-13 3:37 
AnswerRe: reading table from csv Pin
Bernhard Hiller11-Sep-13 3:37
Bernhard Hiller11-Sep-13 3:37 
Questionworking out a triangle hypotenuse Pin
Member 1026649410-Sep-13 23:56
Member 1026649410-Sep-13 23:56 
AnswerRe: working out a triangle hypotenuse Pin
Anurag Sinha V11-Sep-13 0:12
Anurag Sinha V11-Sep-13 0:12 
GeneralRe: working out a triangle hypotenuse Pin
Member 1026649411-Sep-13 0:22
Member 1026649411-Sep-13 0:22 
GeneralRe: working out a triangle hypotenuse Pin
Anurag Sinha V11-Sep-13 0:39
Anurag Sinha V11-Sep-13 0:39 
AnswerRe: working out a triangle hypotenuse Pin
BillWoodruff12-Sep-13 16:33
professionalBillWoodruff12-Sep-13 16:33 
QuestionC# Pin
Member 1026649410-Sep-13 23:11
Member 1026649410-Sep-13 23:11 
AnswerRe: C# Pin
Pete O'Hanlon10-Sep-13 23:19
mvePete O'Hanlon10-Sep-13 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.