metropia
asked on
creating a counter with a for each loop
I need to pass a counter as an argument to a function within a for each loop in vb.net.
my loop:
For Each line In inFileContents.Split(arg, StringSplitOptions.None)
Dim objFtpFileLine As New FtpFileLineClass()
outStatusString = Upload_ToDatabase(FileId, LineNumer, line)
Next
The counter will be assigned to the variable LineNumber.
Any help would be nice.
Thank you.
my loop:
For Each line In inFileContents.Split(arg, StringSplitOptions.None)
Dim objFtpFileLine As New FtpFileLineClass()
outStatusString = Upload_ToDatabase(FileId, LineNumer, line)
Next
The counter will be assigned to the variable LineNumber.
Any help would be nice.
Thank you.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all for your help.
One small question.
I see that the first line to be read is zero element, how can that be altered, so that the first line read is 1?
Thank you
One small question.
I see that the first line to be read is zero element, how can that be altered, so that the first line read is 1?
Thank you
ASKER
would it be to change: For LineNumber As Integer = 0 To lines.Length - 1
To: For LineNumber As Integer = 1 To lines.Length - 1
To: For LineNumber As Integer = 1 To lines.Length - 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window