Trying to write a DLL that accepts both thin and thick controls - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Trying to write a DLL that accepts both thin and thick controls

TrabimanTrabiman Posts: 4Member
I'm working on re-writing a dll using C# and need some help. I want to have a method that when called would be passed either a WinForms combobox or a WebForms dropdownlist. Once received the method would do all of the database work and populate the combobox, for example. I'm having a hardtime with the declaration of the method. Can anyone help me here? Or is this just totally impossible in the .Net world? Since I'm not sure where to post this, seeing as how it also involes the web... I'll also be posting this same message there.

Comments

  • iwilld0itiwilld0it Posts: 1,134Member
    : I'm working on re-writing a dll using C# and need some help. I want to have a method that when called would be passed either a WinForms combobox or a WebForms dropdownlist. Once received the method would do all of the database work and populate the combobox, for example. I'm having a hardtime with the declaration of the method. Can anyone help me here? Or is this just totally impossible in the .Net world? Since I'm not sure where to post this, seeing as how it also involes the web... I'll also be posting this same message there.
    :


    Im gonna answer this in VB.NET, but it will be easy to covert to C# ...

    [code]

    Sub PopulateList(ByRef ctrl As IComponent)
    If TypeOf ctrl Is System.Web.UI.WebControls.DropDownList Then
    ' Handle Web Version
    Return
    End If

    If TypeOf ctrl Is System.Windows.Forms.ComboBox Then
    ' Handle Windows Version
    Return
    End If
    End Sub

    [/code]

    This is just an example. Adjust code to your scenario.
Sign In or Register to comment.