By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

positionning the scrollbar on a form

P: n/a
Sam
Hi,
When I load my form my scrollbar is always positionned automatically at
the bottom for some reasons... How can I force it to be always at the
top?

Thx

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sam
I've actually user32.dll:

Private Const SB_VERT As Integer = 1

Private Declare Function GetScrollPos Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer) As Integer

Private Declare Function SetScrollPos Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer, _
ByVal nPos As Integer, _
ByVal bRedraw As Boolean) As Integer

Public Property VScrollPos(ByVal f As Form) As Integer
Get
Return GetScrollPos(CType(f.Handle, IntPtr), SB_VERT)
End Get
Set(ByVal Value As Integer)
SetScrollPos(CType(f.Handle, IntPtr), SB_VERT, Value, True)
End Set
End Property

However, the scrollbar is positionned correctely but the form is not
refresh, so the form position doesn' t correspond to my scrollbar's.
I've tried a me.Refresh but it wouldn't do either...
Can you help?

Thx

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.