Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scrolling treeview using API

72 views
Skip to first unread message

Thomas Schoch

unread,
Apr 12, 2003, 4:07:31 PM4/12/03
to
I have taken the code below from VB6 and tried to run it in my VB.NET
app. For some unknown reason my treeview won't scroll at all.

What's wrong?


Thomas

Private Declare Function SendMessage Lib "user32" Alias
"SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long,
ByVal lParam As Long) As Long

Const WM_VSCROLL = &H115
Const SB_LINEDOWN = 1
Const SB_LINEUP = 0

Private Sub ScrollUp()
SendMessage(tv1.Handle.ToInt32, WM_VSCROLL, SB_LINEUP, 0)
End Sub

Private Sub ScrollDown()
SendMessage(tv1.Handle.ToInt32, WM_VSCROLL, SB_LINEDOWN, 0)
End Sub

Herfried K. Wagner

unread,
Apr 12, 2003, 6:21:27 PM4/12/03
to
Hello Thomas,

"Thomas Schoch" <tosch_...@swissonline.ch> schrieb:


> I have taken the code below from VB6 and tried to run it in my VB.NET
> app. For some unknown reason my treeview won't scroll at all.

Untested changes:

> Private Declare Function SendMessage Lib "user32" Alias
> "SendMessageA" _
> (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long,
> ByVal lParam As Long) As Long

\\\
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
( _
ByVal hWnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32 _
) As Int32
///

> Const WM_VSCROLL = &H115
> Const SB_LINEDOWN = 1
> Const SB_LINEUP = 0

Declare the constants "As Int32".

> SendMessage(tv1.Handle.ToInt32, WM_VSCROLL, SB_LINEUP, 0)
[...]
> SendMessage(tv1.Handle.ToInt32, WM_VSCROLL, SB_LINEDOWN, 0)

Use tv1.Handle directly.

Es gibt übrigens auch eine deutschsprachige NG zu VB .NET:

news:microsoft.public.de.german.entwickler.dotnet.vb

Regards,
Herfried K. Wagner


Thomas Schoch

unread,
Apr 13, 2003, 3:14:59 AM4/13/03
to
Herfried,

works like a charm, thanks a lot

Thomas

0 new messages