Moving NEXT or Previous by a CommandButton

In a form, in VB4, I have DriveListBox, a DirListBox and a FileListBox in
which there is a list of some jpg pictures. Making a click in any of these, the picture is
displayed in a pictureBox.
What I ask for is:
I would like to add 2 CommandButtons. One for the next picture of the list and one for the previous.
How could I do it? What is the code for these Buttons?
oteAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mark2150Commented:
Myself, I'd get rid of all the of list boxes and go to the common dialog control. They specify a directory and then read all of the .JPG files into a regular list. Once the list is established moving thru it is easy. With the drive list boxes and such the choices are *displayed* in the control but the results are not easy to interpret nor is it easy to move thru the selections.

M
0
mcriderCommented:
See the EE Thread:

   http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10230534

This solution should work for you... It costs 10 points...


Cheers!
0
Erick37Commented:
Code example:

Option Explicit

Private Sub cmdDown_Click()
    Dim ndx As Integer
    'scroll one line up
    ndx = File1.ListIndex
    If ndx = File1.ListCount - 1 Then Exit Sub 'Bottom
    File1.ListIndex = ndx + 1
    'Update filename
    Debug.Print File1.filename
End Sub

Private Sub cmdUp_Click()
    Dim ndx As Integer
    'scroll one line up
    ndx = File1.ListIndex
    If ndx <= 0 Then Exit Sub 'Top
    File1.ListIndex = ndx - 1
    'Update filename
    Debug.Print File1.filename
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.