[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Typed Datasets and Delegate signatures

MattM

6/8/2007 1:17:00 PM

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?
1 Answer

MattM

6/8/2007 1:45:00 PM

0

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

"MattM" wrote:

> 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?