Typed Datasets and Delegate signatures

M

MattM

I am working on a new Windows application with typed datasets and was looking
at creating a generic datagridview user control. I will have several typed
datasets for this application so I thought using one datagridview user
control to handle most of the basics would save time.

I was going to use delegates to handle some of the functions but when it
comes to loading the grid I can't get beyond the fact that each typed dataset
has it's own object return type which means the user control can't have a
generic one for loading the datagridview.

For example, I may have an Employee, Organization, and a Client object each
with it's own class file and custom serialization routine in my business
logic layer (BLL). Each BLL can be hooked up to the grid by setting the
datasource equal to the return of the serialization function that returns a
List(of Employee) or List (of Client). But if I want to make a delegate in my
user control I need to give it a generic signature so that all the typed
datasets can be used.

I tried something like this:

Public Delegate Function del_ReloadGrid() As List(Of Object)

But when I tried to hook up the return from one of my BLLs I get an error
saying that "Value of type system.collections.generic.list(of Client) cannot
be converted to system.collections.generic.list(of object).

Is there a better way to do this? Is it possible to create a generic
signature for the delegate so I can create a base datagridview user control?
 
M

MattM

Not sure if this will be the "best" approach but I think I answered my own
question by doing this:

Public Delegate Function del_ReloadGrid() As IList
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top