CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    Växjö, Sweden
    Posts
    15

    Question 2 listboxes, databinding and adding from one to another?

    Hi again.

    Well I have a listbox, that through databinding has its item added:

    Listbox1.DataSource = Dataset1.cbdata.DefaultView
    Listbox1.ValueMember = Dataset1.cbdata.cbdataIDColumn.ToString
    Listbox1.DisplayMember = Dataset1.cbdata.cbdataColumn.ToString

    Now then through a button I want to "Add" one item from Listbox1 to Listbox2, Listbox2 has no databinding...

    How is this done (example?) how would I add an item and preserve the valuemember and displaymember etc, so that I can return (example?) the "cbdataID" etc from Listbox2 ?

    Regards
    /Kristian

  2. #2
    Join Date
    May 2002
    Location
    Toronto
    Posts
    167
    .... addbutton.click

    Dim x as String

    x = listbox1.selectedItem

    if x <> "" then listbox2.Items.add(x)

    end sub

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