TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rlum
NA
1
0
Why is foreach loop increasing my variable?
Nov 3 2004 11:13 AM
Here is the code: // loop though and add the values to the found parameters int i = 0; foreach (SqlParameter parameter in datahelper.sqlParams) { parameter.Value = paramValues[i++]; } datahelper.sqlParams is an array of 3 SqlParameter objects paramValues is an array of 3 string values the loop is increasing the value of i before it even hits it causing the array to go out of index. thanks in advance.
Reply
Answers (
1
)
Creating a button
C# app gets swapped out and returns to active app slowly