المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Travering a array in C#



C# Programming
11-10-2009, 02:40 AM
I'm working on a application which simulates a pdf reader. I have a issue with traversing the page. Following are the details.

there are two buttons called, "Previous View" and "Next View". These fulnctionality of these two buttons is I can navigate to the previously visited pages.

My requirement is as follows.

Lets say I visit page 1, followed by 10, followed by 15, followed by 12 and back to 10.
i.e, 1->10->15->12->10.

Suppose If I'm @ page 12. if I click on "Previous View", I should nagigate to page 15 and If I click "Next View" I should go to page 10.

My issue is, Suppose I'm @ the last visited page. that is page 10, after page 12. If I click I "Next View" it should not navigate, because it is the last visited page. But what happening is it is navigating to page 15. The reason for that is I'm checking only for the first occurenece of a element. which is @ 2nd position.

this happens only if there is multple occurenec of a element.

I need help in developing the logic.

any suggestion is appreciated.