Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / June 2005

Tip: Looking for answers? Try searching our database.

Bind my own domain classes like a DataSet to GridView in Designer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Norbert Ruessmann - 24 Jun 2005 10:43 GMT
Hello group,
I developed some Domain classes , which are NOT a not related to DataSet /
DataTable etc. in any way. But they provide similar featurs.

A object can for instance contain a collection of Orders, plus a collection
of OrderItems. The collection of Orders contains Orders. Each Order has a
property OrderItems, which returns a collections of OrderItems. This
collection only contains the OrderItems blonging to the corresponding Order
(one to many relation)

From code data binding works perfectly. I can write:

dataGridOrders.DataSource = m_Orders; // instance of Orders Collection
dataGridItems.DataSource = m_Orders;
dataGridItems.DataMember = "OrderItems"; // name of property of Orders class

Thus I can  display master/detail relations very easily, just as if I had
used a DataSet with two tables and a relation object.

Now my Question: I would like to specify DataSource and DataMember in the
Properties Windows of the DataGrid in VS designer, just like I can do with a
typed DataSet. I made my class implement IComponent, thus I can set the
DataSource. But what do I have to implement in my class to be able to
specify the DataMember in designer????
I searched MSDN and the internet for two days now, but could not find any
information on how to do this.

Regards
Norbert Ruessmann
Rockford Lhotka - 24 Jun 2005 14:40 GMT
You don't actually need to implement IComponent. All you should need to do
is add your class(es) as a data source using the Data Sources window.

Once your classes are available as data sources, you can drag-drop them onto
a form or otherwise use them like any other data source within the IDE.

Rocky
rocky.spambad@lhotka.net

> Hello group,
> I developed some Domain classes , which are NOT a not related to DataSet /
[quoted text clipped - 26 lines]
> Regards
> Norbert Ruessmann
Norbert Ruessmann - 24 Jun 2005 15:52 GMT
Thanks for the answer.
But I forgot to metion that I use VS 2003 and .NET 1.1, and as far as I know
the data sources window is a new feature of VS2005/.NET2.0

Regards
Norbert Ruessmann

> You don't actually need to implement IComponent. All you should need to do
> is add your class(es) as a data source using the Data Sources window.
[quoted text clipped - 36 lines]
>> Regards
>> Norbert Ruessmann
Norbert Ruessmann - 28 Jun 2005 10:41 GMT
In the meantime I tried with VS2005 Beta. I can bind my Control to a
DataGridView (and even use the column editor), but in the DataMember
property the chilkd collections do not show up for the one to many
relations.

Does anybody have any idea? In the meantime I have the impression that the
DataGrid (VS2003) and DataGridView (VS2005) at design time only work with
DataSets, and nothing else.

Regards
Norbert Ruessmann

> You don't actually need to implement IComponent. All you should need to do
> is add your class(es) as a data source using the Data Sources window.
[quoted text clipped - 36 lines]
>> Regards
>> Norbert Ruessmann

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.