Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.