By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,816 Members | 2,053 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,816 IT Pros & Developers. It's quick & easy.

Use subset of business class for use in list object

P: n/a
I'm wanting to create a bindable list object made up of a list of business
classes. I'm writing this in a vb.net 1.1 winforms app and am using a code
example by Rocky Lhotka for reference material:
http://msdn.microsoft.com/library/de...et02252003.asp
which makes use of the IEditableObject interface.

My situation is that my business class manages data for a table which has
about 20 columns all of which are represented in the business class. In the
test samples I created from Rockies example, every property in the business
class became part of the bindable list so when I bound a my custom list
object to the datagrid, all 20+ columns showed in the datagrid. However, I
only want to use about 4 columns for the datagrid. I was wondering if there
was an elegant way to make a class that would be used as the ListItem class
and it would be an abstract of the business class and have only the columns
I wanted to use in the datagrid. Furthermore, I want to edit data from this
datagrid, so this ListItem class would need to utilize the New, Save,
Canceled, Delete, etc. methods from the business class with out having to
re-write a lot of extra code.

Can anyone recommend some good ways to approach this? and even better,
recommend some code examples or documentation?

Thanks.

--
mo*******@nospam.com
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Moondaddy,

I am curious, do you want to make a business class which is directly
connected to even a special type of control from the UI?

Seems for me not directly the way to go,

However just my thought,

Cor
Nov 21 '05 #2

P: n/a
Just create a tablestyle with only the columns you want to map to the DataGrid.

"moondaddy" wrote:
I'm wanting to create a bindable list object made up of a list of business
classes. I'm writing this in a vb.net 1.1 winforms app and am using a code
example by Rocky Lhotka for reference material:
http://msdn.microsoft.com/library/de...et02252003.asp
which makes use of the IEditableObject interface.

My situation is that my business class manages data for a table which has
about 20 columns all of which are represented in the business class. In the
test samples I created from Rockies example, every property in the business
class became part of the bindable list so when I bound a my custom list
object to the datagrid, all 20+ columns showed in the datagrid. However, I
only want to use about 4 columns for the datagrid. I was wondering if there
was an elegant way to make a class that would be used as the ListItem class
and it would be an abstract of the business class and have only the columns
I wanted to use in the datagrid. Furthermore, I want to edit data from this
datagrid, so this ListItem class would need to utilize the New, Save,
Canceled, Delete, etc. methods from the business class with out having to
re-write a lot of extra code.

Can anyone recommend some good ways to approach this? and even better,
recommend some code examples or documentation?

Thanks.

--
mo*******@nospam.com

Nov 21 '05 #3

P: n/a
Thanks to both Cor and Dennis,

I'm using a 3rd party datagrid and I can't map select columns for the
binding. Also, I need to bind to a list of business objects so I can use
custom business logic during insert/update/deletes. I thought there would
be a good way to use inheritance or something, but that was more work than
it was worth, and by using inheritance, the grid bound to all of the
properties in the base class anyway. I ended up making a small class (lets
call it clsList for example) which referenced an instance of the business
class. clsList had only the properties I wanted to use in the grid and
utilized all the methods of the business class so there wasn't much to right
in it.

--
mo*******@nospam.com
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
Just create a tablestyle with only the columns you want to map to the
DataGrid.

"moondaddy" wrote:
I'm wanting to create a bindable list object made up of a list of
business
classes. I'm writing this in a vb.net 1.1 winforms app and am using a
code
example by Rocky Lhotka for reference material:
http://msdn.microsoft.com/library/de...et02252003.asp
which makes use of the IEditableObject interface.

My situation is that my business class manages data for a table which has
about 20 columns all of which are represented in the business class. In
the
test samples I created from Rockies example, every property in the
business
class became part of the bindable list so when I bound a my custom list
object to the datagrid, all 20+ columns showed in the datagrid. However,
I
only want to use about 4 columns for the datagrid. I was wondering if
there
was an elegant way to make a class that would be used as the ListItem
class
and it would be an abstract of the business class and have only the
columns
I wanted to use in the datagrid. Furthermore, I want to edit data from
this
datagrid, so this ListItem class would need to utilize the New, Save,
Canceled, Delete, etc. methods from the business class with out having to
re-write a lot of extra code.

Can anyone recommend some good ways to approach this? and even better,
recommend some code examples or documentation?

Thanks.

--
mo*******@nospam.com

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.