Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. how to select next value in listbox after moving a value from it?

how to select next value in listbox after moving a value from it?

Scheduled Pinned Locked Moved Windows Forms
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yawer Iqbal
    wrote on last edited by
    #1

    Dear All, I am using 2 listboxes, 1st containing values and 2nd to hold values selected from 1st listbox. On double clicking in 1st listbox selected value moves to 2nd listbox. Requirment is after movment of selected value to 2nd listbox countrol should be back in 1st listbox and next or previous item (of moved value)should be selected unless their remain some item in 1st listbox. Kindly guide, Yawer

    Y M 2 Replies Last reply
    0
    • Y Yawer Iqbal

      Dear All, I am using 2 listboxes, 1st containing values and 2nd to hold values selected from 1st listbox. On double clicking in 1st listbox selected value moves to 2nd listbox. Requirment is after movment of selected value to 2nd listbox countrol should be back in 1st listbox and next or previous item (of moved value)should be selected unless their remain some item in 1st listbox. Kindly guide, Yawer

      Y Offline
      Y Offline
      yanairon
      wrote on last edited by
      #2

      when performing this action, store the SelectedIndex of your item. then remove it then reselect the index-1 item in the list using SelectedIndex property (make sure to check first if there are still items in the list)

      1 Reply Last reply
      0
      • Y Yawer Iqbal

        Dear All, I am using 2 listboxes, 1st containing values and 2nd to hold values selected from 1st listbox. On double clicking in 1st listbox selected value moves to 2nd listbox. Requirment is after movment of selected value to 2nd listbox countrol should be back in 1st listbox and next or previous item (of moved value)should be selected unless their remain some item in 1st listbox. Kindly guide, Yawer

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        I cheat with this one, create a table with a selected column set to 1 or 0 depending which LB you want it in. I then have a loadgrid method that filters a dataview based on the selected col and loads into each LB (I use listviews). Double click changes the selected value and the LBs are reloaded. A couple of caveats, each dataview need to be a copy of the table and the table should be quite small. Benifit, the items are sorted by the dataview when you reload.

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups