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. Visual Basic
  4. Listbox swap

Listbox swap

Scheduled Pinned Locked Moved Visual Basic
question
6 Posts 2 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.
  • J Offline
    J Offline
    Jason Baggett
    wrote on last edited by
    #1

    Ok easy one for y'all, but Im stumped. I have 2 listboxes. First listbox is populated with the 12 months and when double clicked on a month, it needs to move to the other listbox. The second listbox is initially blank. Any ideas?? Thanks in advance Jason

    C 1 Reply Last reply
    0
    • J Jason Baggett

      Ok easy one for y'all, but Im stumped. I have 2 listboxes. First listbox is populated with the 12 months and when double clicked on a month, it needs to move to the other listbox. The second listbox is initially blank. Any ideas?? Thanks in advance Jason

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Remove it from the items collection on one, and add it to the other. VB6 or VB.NET ? Christian Graus - Microsoft MVP - C++

      J 1 Reply Last reply
      0
      • C Christian Graus

        Remove it from the items collection on one, and add it to the other. VB6 or VB.NET ? Christian Graus - Microsoft MVP - C++

        J Offline
        J Offline
        Jason Baggett
        wrote on last edited by
        #3

        1st Listbox has a collection of months. When double clicked on a month it moves to the 2nd Listbox. I would assume that I need to have it move back to the 1st listbox when double clicked as well. VB.Net Thanks Christian

        C 1 Reply Last reply
        0
        • J Jason Baggett

          1st Listbox has a collection of months. When double clicked on a month it moves to the 2nd Listbox. I would assume that I need to have it move back to the 1st listbox when double clicked as well. VB.Net Thanks Christian

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick Dim S As String = ListBox1.SelectedItem ListBox2.Items.Add(S) ListBox1.Items.Remove(S) End Sub Private Sub ListBox2_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick Dim S As String = ListBox2.SelectedItem ListBox1.Items.Add(S) ListBox2.Items.Remove(S) End Sub You'd need to add something to rearrange them in the right order, if you want that. Christian Graus - Microsoft MVP - C++

          J 1 Reply Last reply
          0
          • C Christian Graus

            Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick Dim S As String = ListBox1.SelectedItem ListBox2.Items.Add(S) ListBox1.Items.Remove(S) End Sub Private Sub ListBox2_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick Dim S As String = ListBox2.SelectedItem ListBox1.Items.Add(S) ListBox2.Items.Remove(S) End Sub You'd need to add something to rearrange them in the right order, if you want that. Christian Graus - Microsoft MVP - C++

            J Offline
            J Offline
            Jason Baggett
            wrote on last edited by
            #5

            CG, you da man as always. I knew it was something very simple. I couldn't see the forest because of the trees. Thanks again. I'll work on customizing it from here. THANKS AGAIN CHRISTIAN!!!! JB

            C 1 Reply Last reply
            0
            • J Jason Baggett

              CG, you da man as always. I knew it was something very simple. I couldn't see the forest because of the trees. Thanks again. I'll work on customizing it from here. THANKS AGAIN CHRISTIAN!!!! JB

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              *blush* you're welcome. Christian Graus - Microsoft MVP - C++

              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