How to detect if WinForms Panel has scrolled to the end?


I am developing a WinForms application in which there is a panel which contains some user-controls. When the panel loads for the first time it shows 10 user controls. But when it is scrolled down completely it should load and append more user controls at the end of the panel. I am trying to achieve this using this code:

private void topicContainer_Scroll(object sender, ScrollEventArgs e)
      if (e.NewValue== topicContainer.VerticalScroll.Value)
                MessageBox.Show("Topics load here");

Its just a trial. I don't know what actually this NewValue means. So, can you please tell how to accomplish my this task?

MSDN covers the case quite nicely. Have you checked it out?

Remember though about the weird behavior of scrollbars: user is never able to reach its Maximum value. Read remarks in the ScrollBar.Maximum MSDN help page.