The form has a webbrowser component and a "next" button, there is also a text file with a list of links that should open each time you click on the "next" button. those. There was a click - the first link was opened, the second link was clicked again - the second link, etc. How to organize it?

thank you in advance

    1 answer 1

    1. After initialization, load the lines into the array:

      string[] readText = File.ReadAllLines(path); 
    2. Convert array to stack:

       stack = new Stack<string>(readText); 
    3. In the button handler:

       this.webBrowser1.Navigate(stack.Pop());//Удаляет и возвращает объект из верхней части Stack<T>.