thomasmutton
asked on
C# for loop
Hello experts.
I have a for loop that works great but I want the first number to be one instead of zero.
how would I do this?
I have a for loop that works great but I want the first number to be one instead of zero.
how would I do this?
for (int i = 0; i < ds.Tables["tbl_trainingmodulesquestions"].Rows.Count; i++)
{
i.tostring();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oxyoo that will execute the loop once less than the number of rows in the table which I don't think he wants.
Oh I see the <=
Instead he'll get an array index out of bounds when he tries ds.Tables["tbl_trainingmod ulesquesti ons"].Rows [i]....
Instead he'll get an array index out of bounds when he tries ds.Tables["tbl_trainingmod
sorry, this should work better..
for (int i = 1; i < ds.Tables["tbl_trainingmodulesquestions"].Rows.Count; i++)
{
i.tostring();
}
Ok, I see your point CyrexCore2k.
ASKER
Brilliant. Thanks alot.
Open in new window