473,396 Members | 1,861 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,396 software developers and data experts.

Tricky situation( at least for me) : Binding base class driven collection to DB Grid

I have 2 questions:
1. I have a base class called
class MyBaseObject
{
}

All my classes are derived from MyBaseObject.
I also have a collection dervied from IBindingList and CollectionBase
like so,
class MyCollection : CollectionBase,IBindingList
{
....
}

I also have a class called Customer derived from MyBaseObject
class Customer: MyBaseObject
{
public CustomerId
{
get { return _CustomerId;}
set { _CustomerId = value;}
}
Now I add a few customers to my collection class.
MyCollection myColl = new MyCollection();
myColl.Add ( new Customer(1));
myColl.Add ( new Customer(2));
myColl.Add ( new Customer(3));
At some point in the form, I attach the collection to the datagrid

datagrid1.Datasource = myColl;

Problem:
I see the number of rows in the datagrid to be 3 ( left side sticky
col) but I don't see the columns.
I know the problem. My Customer class is derived from MyBaseObject
class and MyBaseObject doesnot have any public properties.
If I remove MyBaseObject from the picture by not deriving Customer from
MyBaseObject, everything works fine : I see CustomerId column being
displayed on the grid.

You must have guessed my question. How do I take care of the problem.

Thanks for reading the post.

}

Nov 17 '05 #1
0 916

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

Similar topics

14
by: Curzio Basso | last post by:
Hi all. I have a couple of question regarding the following situation: class A(object): def __init__(self): pass class B(object): def __init__(self):
6
by: Paul | last post by:
In real life situation, do we ever come across a situation where we would need two base objects in an object. A snippet is worth 1000 words (: so... class Base { }; class Derived1:public Base...
6
by: cppsks | last post by:
Consider the following: class BaseInterface { public: virtual void something() = 0; }; class AbstractSubclass : public BaseInterface {
1
by: Mike Johnson | last post by:
I got the error below, can someone provide the answer in code to the problem listed below. Thanks. You have tried to reference a non-shared member of a class from within a shared method or...
4
by: Jamie Hankins | last post by:
I'm probably being dense here. In the following situation: class Base { int x; int y; } class Decendant : Base { int z; }
5
by: Jess | last post by:
Hello, I've seen two forms of template declarations template<typename T> class A{...}; and template<class T>
2
by: racheliH | last post by:
Hi, I have the following situation: Class absClass { Class B {}; virtual void f(B b)=0;
8
by: ManicQin | last post by:
Hi lets say I have the next situation class base { pubic: ;) base() {} virtual ~base(){} virtual init() {//do init } };
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.