Typed Datasets and Delegate signatures

Discussion in 'ASP .Net Building Controls' started by MattM, Jun 8, 2007.

  1. MattM

    MattM Guest

    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?
    MattM, Jun 8, 2007
    #1
    1. Advertising

  2. MattM

    MattM Guest

    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?
    MattM, Jun 8, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Thomas
    Replies:
    3
    Views:
    366
  2. Big D

    Strongly typed datasets and XML

    Big D, Feb 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    442
    bruce barker
    Feb 17, 2004
  3. Sparky
    Replies:
    0
    Views:
    401
    Sparky
    Nov 15, 2004
  4. Duncan Welch

    Strongly typed datasets and nested repeaters

    Duncan Welch, Apr 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,014
    MattC
    Apr 7, 2005
  5. chris
    Replies:
    2
    Views:
    2,032
    chris
    Feb 25, 2006
Loading...

Share This Page