473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Datas ource = 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 929

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

Similar topics

14
1477
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
2842
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
1342
by: cppsks | last post by:
Consider the following: class BaseInterface { public: virtual void something() = 0; }; class AbstractSubclass : public BaseInterface {
1
1059
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 shared method initialize. The following code provides an example of such a situation: Class Sample
4
1807
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
425
by: Jess | last post by:
Hello, I've seen two forms of template declarations template<typename T> class A{...}; and template<class T>
2
2931
by: racheliH | last post by:
Hi, I have the following situation: Class absClass { Class B {}; virtual void f(B b)=0;
8
1698
by: ManicQin | last post by:
Hi lets say I have the next situation class base { pubic: ;) base() {} virtual ~base(){} virtual init() {//do init } };
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.