CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2022
    Posts
    4

    Multiple listboxes

    Hi all.
    I have a question regarding multiple list boxes. I am coding for Visual Basic 6.

    I am developing a box office program and it is nearly complete. However, I have four listboxes, one for show name, one for time, one for date and one for day. The listboxes sit side by side.

    The show listbox is lst_show
    The date listbox is lst_date
    The day listbox is lst_day
    The time listbox is lst_time

    At the moment all the code to select the show is called by clicking the name in the show listbox. I have coded the others to follow the selection (all in a mouse down event).

    Code in lst_show:-

    Lst_date.listindex = lst_show.listindex
    Lst_time.listindex = lst_show.listindex
    Lst_day.listindex = lst_show.listindex

    And the same for selecting the shows from the other listboxes. Time, day and date.

    Code in lst_day:-

    Lst_show.listindex = lst_show.listindex
    Lst_time.listindex = lst_show.listindex
    Lst_date.listindex = lst_show.listindex

    Code in lst_date:-

    Lst_show.listindex = lst_show.listindex
    Lst_time.listindex = lst_show.listindex
    Lst_day.listindex = lst_show.listindex

    Code in lst_time:-

    Lst_show.listindex = lst_show.listindex
    Lst_day.listindex = lst_show.listindex
    Lst_date.listindex = lst_show.listindex

    All is good and the listboxes all follow each other. The problem I have is that I cannot get the event in lst_day, lst_date and lst_time to trigger the code in lst_show, the idea being that you can click the day, time, date or show to select it.

    Any ideas?

    Thank you.

  2. #2
    Join Date
    May 2022
    Posts
    4

    Re: Multiple listboxes

    Sorry. The code was wrong and I cannot edit the post. this is the correct code:-

    Hi all.
    I have a question regarding multiple list boxes. I am coding for Visual Basic 6.

    I am developing a box office program and it is nearly complete. However, I have four listboxes, one for show name, one for time, one for date and one for day. The listboxes sit side by side.

    The show listbox is lst_show
    The date listbox is lst_date
    The day listbox is lst_day
    The time listbox is lst_time

    At the moment all the code to select the show is called by clicking the name in the show listbox. I have coded the others to follow the selection (all in a mouse down event).

    Code in lst_show:-

    Lst_date.listindex = lst_show.listindex
    Lst_time.listindex = lst_show.listindex
    Lst_day.listindex = lst_show.listindex

    And the same for selecting the shows from the other listboxes. Time, day and date.

    Code in lst_day:-

    Lst_show.listindex = lst_day.listindex
    Lst_time.listindex = lst_day.listindex
    Lst_date.listindex = lst_day.listindex

    Code in lst_date:-

    Lst_show.listindex = lst_date.listindex
    Lst_time.listindex = lst_date.listindex
    Lst_day.listindex = lst_date.listindex

    Code in lst_time:-

    Lst_show.listindex = lst_time.listindex
    Lst_day.listindex = lst_time.listindex
    Lst_date.listindex = lst_time.listindex

    All is good and the listboxes all follow each other.


    The problem I have is that I cannot get the event in lst_day, lst_date and lst_time to trigger the code in lst_show, the idea being that you can click the day, time, date or show to select it.

    Any ideas?

    Thank you.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,248

    Re: Multiple listboxes

    Why not using one list control instead of four list boxes?
    Victor Nijegorodov

  4. #4
    Join Date
    May 2022
    Posts
    4

    Re: Multiple listboxes

    I have to use four. The text information in each list is used to print the tickets, and I cannot change that now. As I said, the listboxes follow each other, no problem. However, the lst_show listbox triggers loads of code and opens and reads multiple files fro the HDD. I just cannot get the event in the other listboxes to trigger the events in the lst_show listbox.

    Thanks.

  5. #5
    Join Date
    May 2022
    Posts
    4

    Re: Multiple listboxes

    Attachment 36048

    Here is a shot of the main screen with the four listboxes. The only way I could do it in the end was to put the code in a call and run from each box and link the boxes together with listbox.listindex = listbox.listindex.

    Thank you all.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured