Scrolling a form to a particular point...

B

BradC

I have a long VB.NET form with a scrollbar (autoscroll=true, not an actual
scrollbar control).
In response to one particular buttonclick, I need to scroll down to a
particular point on the form, and I can't figure out how to do it! Nothing I
try seems to work.

Just in case it matters, it is a maximized child window of an MDI parent
application.

Thanks for your help!
 
H

Herfried K. Wagner [MVP]

* "BradC said:
I have a long VB.NET form with a scrollbar (autoscroll=true, not an actual
scrollbar control).
In response to one particular buttonclick, I need to scroll down to a
particular point on the form, and I can't figure out how to do it! Nothing I
try seems to work.

Set the form's 'AutoScrollPosition' property.
 
B

BradC

Thanks. That does move it, but it doesn't seem to move it to the right
place.

Let me give an example:
My form totals about 1000 pixels tall.
I have a panel starting about y=500 that I want to appear at the TOP of the
window.
(So I want to see from 500 to however tall their window size is).

If I try to set .AutoScrollPosition = New Point(0, 500),
it scoots down just a tiny bit so your viewing from, say, 100 to 600.
If I click the same button again, THEN it scoots down further so you can see
the entire panel.

Is my syntax correct?
Thanks
BradC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top