473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

DataSource and Interfaces

This is probably a yes/no answer...

I have a datasource for a combobox, and my datasource is an IList. This
list may be composed of two class types, but all implement an INavItem
interface consisting of an ID, and Display field.

Can I specify an interface for the Display/ValueMember fields? I can't seem
to add "INavItem.Display" for the DisplayMember - doesn't work.
How does DisplayMember work through reflection to retrieve the display
values?

Thanks.
Dec 12 '05 #1
2 1717
have you tried to just set "Display" as the DisplayMember. when you
should use a datatable you have to use the columnname as displaymember
and not datarow.columnname

gtz,
Dries

John Richardson wrote:
This is probably a yes/no answer...

I have a datasource for a combobox, and my datasource is an IList. This
list may be composed of two class types, but all implement an INavItem
interface consisting of an ID, and Display field.

Can I specify an interface for the Display/ValueMember fields? I can't seem
to add "INavItem.Display" for the DisplayMember - doesn't work.
How does DisplayMember work through reflection to retrieve the display
values?

Thanks.

Dec 13 '05 #2
it's an IList of type ArrayList, and I have two types of custom classes. I
think the answer is no on this one. :)

It doesn't matter... I ditched the DataSource binding technique anyways due
to serious gimpiness on the part of the combobox control (ie: the .Text
property not matching the display when the Display is not an item in the
list!!!), and opted for a manual insertion of items to the .Items
collection. It seems that every time I try to save time with databinding, I
get burned. It's really not much of a time saver when you factor in
debugging.

"Franky" <dr***@bestopia.be> wrote in message
news:11***************@seven.kulnet.kuleuven.ac.be ...
have you tried to just set "Display" as the DisplayMember. when you should
use a datatable you have to use the columnname as displaymember and not
datarow.columnname

gtz,
Dries

John Richardson wrote:
This is probably a yes/no answer...

I have a datasource for a combobox, and my datasource is an IList. This
list may be composed of two class types, but all implement an INavItem
interface consisting of an ID, and Display field.

Can I specify an interface for the Display/ValueMember fields? I can't
seem to add "INavItem.Display" for the DisplayMember - doesn't work.
How does DisplayMember work through reflection to retrieve the display
values?

Thanks.

Dec 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: baylor | last post by:
In C#, an interface cannot mark any method as static. i'm told the ILASM supports it but i've never tested that Two questions. First, why? OK, i've heard the reason about interfaces being...
1
by: praveen benna via DotNetMonster.com | last post by:
hi, I wanted to create windows custom control which contains a tree view and grid.The tree view contains folder directory and grid reflects the contents of selected folder.(similar to windows...
30
by: Frank Rizzo | last post by:
We are having one of those religious debates at work: Interfaces vs Classes. My take is that Classes give you more flexibility. You can enforce a contract on the descendant classes by marking...
8
by: John | last post by:
What is the purpose / benefit of using an interface statement? It doesn't seem like anything more than a different way to make a class... (except you can't define any procedures in an interface...
9
by: Sean Kirkpatrick | last post by:
To my eye, there doesn't seem to be a whole lot of difference between the two of them from a functional point of view. Can someone give me a good explanation of why one vs the other? Sean
18
by: _dee | last post by:
Question about best use of interfaces: Say there's a 'Master' class that needs to implement a few interfaces: class Master : I1, I2, I3 { } The actual code already exists in smaller...
22
by: RSH | last post by:
Hi, I have been reading on interfaces working on samples I've run across on the web. For the life of me I cannot seem to grasp them. It appears to me that interfaces are simply blueprints to...
5
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am actually a VB.Net guy, but I have worked somewhat with C++ and C#. I just want to ask about the relationship between Abstract Classes and Interfaces. My first question is if...
23
by: A.Gallus | last post by:
If I declare a function pure virtual: class A { virtual void myfunc() = 0; } and I derive a class from A: class B : public A
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.