iLogic - for loop ends earlier than it has to

iLogic - for loop ends earlier than it has to

Anonymous
Not applicable
775 Views
3 Replies
Message 1 of 4

iLogic - for loop ends earlier than it has to

Anonymous
Not applicable

Dear Fellows,

Do You have any idea why this loop always ends with increment No. of m=11, instead of moving forward untill variable m=NoB  in a first "while" loop?

If PlatformType = "Right" Then

	For m=1 To 30
		While m <= NoB
			Try
				Feature.IsActive("RevolutionSrf" & m) = False
				Feature.IsActive("RevolutionSrf-" & m) = False
				Feature.IsActive("RightRevolutionSrf" & m) = True
				
				MessageBox.Show(m, "Title")

			Catch
			End Try
		m=m+1
		End While

		While m > NoB And m <= 30
			Try
				Feature.IsActive("RevolutionSrf" & m) = False
				Feature.IsActive("RevolutionSrf-" & m) = False
				Feature.IsActive("RightRevolutionSrf" & m) = False
				
			Catch
			End Try
		m=m+1
		End While		
	Next

End If
0 Likes
776 Views
3 Replies
Replies (3)
Message 2 of 4

HermJan.Otterman
Advisor
Advisor

What is the number of Nob?

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 3 of 4

Anonymous
Not applicable

NoB is variable, for this moment it is 25

0 Likes
Message 4 of 4

HermJan.Otterman
Advisor
Advisor

when I try the loop it runs fine.

I think that the problem is that when m gets greater then 11 there is some error with the feature.isActive lines so it will go to the Catch and not to your Messagebox line.

to test, put the messagebox line :

MessageBox.Show(m, "M Title")

 right after the first "while" line and you will see that is is counting up

 

I hope this helps

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes