views:

197

answers:

1

I have a form that has a number of controls on it (enough that the scroll bar is visible). How can I programmatically control the scroll window?

I can fake it now by calling the .Select() method on the last control in the Form, but I'd really like to be able to scroll all the way to the bottom of the window.

+2  A: 

The Form has an AutoScrollPosition property. You can set it like in the following example:

this.AutoScrollPosition = new Point(0, this.Height);

This will scroll the form exactly to the bottom. For this to work though, you need to have the Form.AutoScroll property set to True. Setting this to True, makes the form show scroll bars. I am not sure how one could hide them but still get the benefit of using AutoScrollPosition.

Petros
Thanks, I'll give this a shot when I get into the office! (then I'll set this as answered)
Joe Basirico
thanks! it worked for me.
Joe Basirico
You are welcome.
Petros