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