i want to use a scroll bar in my VB.net form but with the AUTOSCROLL = false...

please provide me with a simple code...
tnx in advance...


to make my problem clear...

i want to create a form which has a picture box with ten images...
if the image is bigger than the picture box, then a horizontal or vertical scroll bars will appear.
i need a code for both scroll bars...just a simple code will do...

please...need this for my projects...
any help will be much appreciated...


Normally scrollable objects have the following properties:

AutoScroll -automatically show scrollbars (True /False)
HScroll - Horizontal Scrollbar (True/False)
VScroll - Vertical Scrollbar (True/False)

e.g. Switch on a horizontal scroll bar:

MyObject.HScroll = True

I'm just not sure if the picture box supports scroll bars I assume it will though.
This may help:


the problem that i posted above is for my project. we are not allowed to use autoscroll for scrolling images that's why i said:

"i want to use a scroll bar in my VB.net form but with the AUTOSCROLL = false..."

so we have to create our own simple code for both Hscroll and Vscroll.

luckily, i manage to create a very simple code for Hscroll. here it is:

Dim y as Integer
Dim pic(28) As Image

y = VScrollBar1.Value

If VScrollBar1.Value <= y Then

'pic (y)

y += 1
Select Case y
Case 1 : PictureBox1.Image = My.Resources.a
Case 2 : PictureBox1.Image = My.Resources.b
Case 3 : PictureBox1.Image = My.Resources.c
Case 4 : PictureBox1.Image = My.Resources.d
Case 5 : PictureBox1.Image = My.Resources.e

End Select
y -= 1

what i did is that i created a variable to hold the Value of HscrollBar1 and sort of attach the values of images to it. that's why whenever the scrollbar scrolls, so does the images.
it's very simple but convenient to use for my project. i hope that this simple solution will help others who have the same problem. but if you have a better code than this, please let me know.



the solution that i posted just now is for scrolling images as in one by one. i haven't found a simple code yet for scrolling images bigger than the picture box. if you have code, i'll be glad to have it...

tnx again,

(P.S. thanks to G Waddell for the reply)