+ Reply to Thread
Results 1 to 10 of 10

scrolling through listbox item's with button's

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    scrolling through listbox item's with button's

    hello.

    within the userform contacts, when mouse-over the image two buttons are shown.
    I want when one of these buttons are it displays the next image. the names of all images for the contact are loaded in userform1 listbox. also change the name of the label1.caption.

    The part im having trouble with is knowing where the current picture name is loacated within the listbox.

    cheers

    on a side note, if insted of using a picture object i use a activex picture viewer thing. Can i play movies within the same object as being used for the pictures.
    Attached Files Attached Files
    Last edited by D_Rennie; 10-03-2009 at 01:10 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: select next listbox item.

    That took some thinking though i got there in the end.
    Please Login or Register  to view this content.
    and the reverse for the other im guessing.

  3. #3
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: select next listbox item.

    Please Login or Register  to view this content.
    going backwards throught the list.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: select next listbox item.

    Try this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: scrolling through listbox item's with button's

    I could not work out how to get your example working.

    Can you not make use of the listboxes ListIndex property?
    Cheers
    Andy
    www.andypope.info

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: scrolling through listbox item's with button's

    cheers ill give it a go in a sec.

    just noticed with the code i put up.
    If the listbox is made up of the save values. so (1) 1.jpg (2) 1.jpg the buttons wont do a thing.
    And when the items in the listbox are all differnt (1) 1.jpg (2) 22.jpg it will loop through the items with the use of one button (withough error's)

  7. #7
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: scrolling through listbox item's with button's

    Andy yeah that was just left in there from when i started thinking of a way to do it. probley should have pulled that out before posting

    roy I tryed it though it didnot work. im running this from Combobox_list... userfrom and the lisbox is in userform1.
    so i put
    Please Login or Register  to view this content.
    you have a couple things in there i have never seen so im not sure if im doing it correctly.

    im happy with the other code and going with one button it will work within the constraints of the form. though it would be great to understand what you are going for there
    Last edited by D_Rennie; 10-03-2009 at 01:28 PM.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: scrolling through listbox item's with button's

    I don't see why you need to complicate matters with a second UserForm. What is the object o changing images this way? I would have thought that a spinbutton on the form to scroll throug the records would be better. For a similar project I simply listedvthe image name in the database then as the records changed the image changed to match

  9. #9
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: scrolling through listbox item's with button's

    the reason i went with the second userform is i though it made it easy to upload files and remove files withough having to go to the sheet or clutter up the 1st form.
    there realy is not any point to allowing more than one image for each contact it was just somethink that i though i would play with.

    For a similar project I simply listedvthe image name in the database then as the records changed the image changed to match
    is that what you done within the contacts project that you have on your site. Ill download it again and have a run through the code. I always pick up new idears each time i look at your work.

    have a probem that i cant see why it is happening,
    i have put in the image1.mousemove to show the label2 and button4 though for some reason it will not show the label though will show the button.

    cheers
    Attached Files Attached Files

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: scrolling through listbox item's with button's

    The contacts form is a very simpledemo of how to transfer data from one sheet to a data sheet. The project with the images was more complicated & for a client

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1