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. Generic List problem

Generic List problem

Scheduled Pinned Locked Moved Visual Basic
help
6 Posts 4 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.
  • C Offline
    C Offline
    carrigart
    wrote on last edited by
    #1

    Hi, Have a small problem. I have two generic lists that are bound to two separate Listboxes Private sourceList AS New List(Of Person) Private targetList As New List(Of Person) Private p As New Person("Johnny","Chicago") sourceList.Add(p) lstSourcebox.DataSource = sourceList lstSourcebox.DisplayMember = "Name" lstTargetbox.DataSource = targetList lstTargetbox.DisplayMember = "Name So when I try to drag and drop a Person object the data is placed in the targetList but the lstTargetbox doesnt show any info. Is there someway that i have to refresh it or something. Thanks :)

    A C H 3 Replies Last reply
    0
    • C carrigart

      Hi, Have a small problem. I have two generic lists that are bound to two separate Listboxes Private sourceList AS New List(Of Person) Private targetList As New List(Of Person) Private p As New Person("Johnny","Chicago") sourceList.Add(p) lstSourcebox.DataSource = sourceList lstSourcebox.DisplayMember = "Name" lstTargetbox.DataSource = targetList lstTargetbox.DisplayMember = "Name So when I try to drag and drop a Person object the data is placed in the targetList but the lstTargetbox doesnt show any info. Is there someway that i have to refresh it or something. Thanks :)

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Well, first of all let me know if Name property is declared public inside the Person Class or not. It can only be shown the members in the List using DisplayMember which are Exposed using Properies. :rose:

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      1 Reply Last reply
      0
      • C carrigart

        Hi, Have a small problem. I have two generic lists that are bound to two separate Listboxes Private sourceList AS New List(Of Person) Private targetList As New List(Of Person) Private p As New Person("Johnny","Chicago") sourceList.Add(p) lstSourcebox.DataSource = sourceList lstSourcebox.DisplayMember = "Name" lstTargetbox.DataSource = targetList lstTargetbox.DisplayMember = "Name So when I try to drag and drop a Person object the data is placed in the targetList but the lstTargetbox doesnt show any info. Is there someway that i have to refresh it or something. Thanks :)

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

        You just need to databind the control again, or manually add the item ( you may not be able to manually add to a databound item ). The control does not watch the source, it only binds when you tell it to

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        1 Reply Last reply
        0
        • C carrigart

          Hi, Have a small problem. I have two generic lists that are bound to two separate Listboxes Private sourceList AS New List(Of Person) Private targetList As New List(Of Person) Private p As New Person("Johnny","Chicago") sourceList.Add(p) lstSourcebox.DataSource = sourceList lstSourcebox.DisplayMember = "Name" lstTargetbox.DataSource = targetList lstTargetbox.DisplayMember = "Name So when I try to drag and drop a Person object the data is placed in the targetList but the lstTargetbox doesnt show any info. Is there someway that i have to refresh it or something. Thanks :)

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          I doubt that the fact that your lists are generic is the cause of your problem. Take a look at this thread[^], from a while ago, which basically had the same problem. Unfortunately any code is C# but you may be able to get enough from the textual parts to apply it to your situation. If not and you are not sufficiently familiar with C# to use it as it is, please post back. :)

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          C 1 Reply Last reply
          0
          • H Henry Minute

            I doubt that the fact that your lists are generic is the cause of your problem. Take a look at this thread[^], from a while ago, which basically had the same problem. Unfortunately any code is C# but you may be able to get enough from the textual parts to apply it to your situation. If not and you are not sufficiently familiar with C# to use it as it is, please post back. :)

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

            C Offline
            C Offline
            carrigart
            wrote on last edited by
            #5

            Thank you very much, That worked a treat. Thanks again

            H 1 Reply Last reply
            0
            • C carrigart

              Thank you very much, That worked a treat. Thanks again

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #6

              My pleasure. :)

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              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