I do not understand how to make my scrollbar on a panel work

G

Guest

I am trying to stretch the dinky screen of the iPaq by adding a panel with a
scrollbar.

I got the panel on and populated with stuff, and the scrollbar set up but I
am not experienced and cannot figure out how to make the scrollbar talk to
the panel position.

I tried to add this following code, which does absolutely nothing and
doesn't even fire when you change the position of the scrollbar. The value
of VscrollBar1 does change but nothing is connecting.

Private Sub VScrollBar1_ValueChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs)
If VScrollBar1.Value <> 0 Then
Panel1.Top = -(VScrollBar1.Value)
Else
Panel1.Top = 0
End If
End Sub


I have looked at some of the other posts, and they assume more knowledge
than I have. Could someone explain this using simple and complete terms? I
would be eternally, (or at least for a real long time) grateful!
 
D

Daniel Moth

Without looking at the method body, I'll stay on your comment:
doesn't even fire when you change the position of the scrollbar. The
value

Unless you've made a typo in the post, you are missing a Handles
VScrollBar1.ValueChanged i.e.
Private Sub VScrollBar1_ValueChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles VScrollBar1.ValueChanged

After fixing that (or if you are manually hooking to the event with
AddHandler), check out these threads:
http://groups-beta.google.com/group...roll+panel&qt_g=1&searchnow=Search+this+group

Cheers
Daniel
 
G

Guest

Thank you that was it.

Somehow all of my handles fell off all of my subroutines. I replaced all
of the button events, but didn't realize this one was off as well. Another
programmer here said that happened to him once too, but he didn't know why
either. Are you familiar with this phenomenon?

L.
 
D

Daniel Moth

I can't say it has happened to my code/projects... glad it solved it
though...

Cheers
Daniel
 

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