+ Reply to Thread
Results 1 to 6 of 6

removing and replacing items in multi column listbox.

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

    removing and replacing items in multi column listbox.

    Hello.

    Ive been having lots of trouble programing a multi column listbox to play ball. On the form there is 1 tree view and two listbox's.
    the object is to double click a list 1 item and have that go into the list 2

    Connected to the listbox2_dblClick.. Takes the selected list item and adds to columns 1 intergra value.
    This places a annoyance to me where listbox 2 is not fully populated (you will see ive fully populated the list during my own testing) and a item is selcted if double click on a blank part of the listbox it will increase the int value of the selected item.

    I though of populating the list with blanks (used "." as visual) so a cheek could be made on the double click item and if blank do nothing.

    Ive tryed looping the list loading into an array... Though i got close be .removeitem(0) if "." thoguh that failed once i loaded the tail end of the list back up with "." (this number will decrese on each unique list item being added, Not to disurb the scroll part repmaturly)

    A Code adventure that is a little trival and not 100% nessary, though even with sore eyes and head to match im not giving up just yet.

    The file probley explains it better than my senceless rants.

    cheers
    Attached Files Attached Files
    Last edited by D_Rennie; 12-13-2009 at 10:21 AM.


  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: removing and replacing items in multi column listbox.

    Hello David,

    I have the workbook open. Looks interesting. I have to go out for awhile, about an hour at most, and will take a closer look when I come back.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

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

    Re: removing and replacing items in multi column listbox.

    sounds good.

    hopefully i can beat you to the punch i think im getting close.
    ill post current code when you get back if you like.

    cheers

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: removing and replacing items in multi column listbox.

    Hello David,

    I have run the code trough quite a few variations, and I don't see any problems with adding to or removing items from ListBox2. The counts increment and decrement accordingly. When the count reaches 1, I am asked if I want to remove the item. If I answer yes, it is removed. Is there something more subtle happening that I missed?

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

    Re: removing and replacing items in multi column listbox.

    sorry for the late reply.
    The adding to the colum 1 value and removing the col 1 val works, bad Thread title + explation

    connected to the listbox2 dblclick is allwoing the user to add another integra to the selected line column 1.
    Here is the trival problem. If a user selects a valid listbox line and clicks some white space(rows in listbox that are unloaded *empty) the selected row integra l will incress even withough the mouse being over that line.
    like i said trival. more of a learning thing now.

    so the though was to load " " spaces into the list below a item that acts as a buffer row that stops this acdental increse.

    so the though was to if listbox.count is at or below (in this case 8) run the sort based on the column 1 value of each row.
    There i a issue in the redim part leaving the array with a row with blank data.

    I have so go again for a bit, I can try to clear anythink up when i get back.

    form code
    Please Login or Register  to view this content.
    Cheers

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

    Re: removing and replacing items in multi column listbox.

    Solved the little bugger.

    I knew it was possible just a learning curb more than anythink.
    Only listbox2 has the cracked code attached, I finish it as a function that can be used with all UF listbox's.
    Attached Files Attached Files

+ 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