tags:

views:

291

answers:

1

In windows form - have a panel in which a text control were added. On opening the form , I need the panel scroll bar to be at the TOP position.ie., near to the first control. Now when the form is opened , the panel scroll bar is at the BOTTOM.ie., at the last control.

+1  A: 

On load, try to set the panel's VerticalScroll property to 0

panel1.VerticalScroll.Value = 0;

EDIT: Assuming you have panel1.AutoScroll = true

Setting the vertical scroll value to 0 will scroll to the top, however the vertical slider won't.

Also, maybe you have some control at the bottom of the panel that gets the focus (that should force the panel to scroll down). Setting the focus to the text box at the top of the panel will keep the scroll on top. (but then again maybe you don't want to set the focus to a control at the top)

tzup
Hey thanks.it works with setting panel1.VerticalScroll.Value = 0;
Perhaps you could accept this answer as correct?
Rhys Jones