Results 1 to 5 of 5

Thread: Loading UserControl dynamically from dll

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Loading UserControl dynamically from dll

    Hi guys

    I'm trying to load up a control from a dll dynamically onto my form, but i cannot seem to get it right. Here is some of the codebehind of my form:

    VB Code:
    1. ' Add the Page Content
    2. aPlaceholder = CType(aSkin.FindControl("content"), PlaceHolder)
    3. If Not (aPlaceholder Is Nothing) Then
    4.     Dim aPageContent As UserControl
    5.     aPageContent = CType(Me.LoadControl(aPage.Content), UserControl)
    6.     aPlaceholder.Controls.Add(aPageContent)
    7. End If

    Now the usual way to go about this is to use this LoadControl(VirtualPath) method, and put the usercontrol's virtualpath in the parameter (this value sits in aPage.Content). My problem however, is that this usercontrol exists in another project that has been compiled into a dll and added as a reference to the current project. How can I load up this control??? It does not have a virtual path does it, as it is in the dll?

    I could always instantiate this control (which works fine), but then I don't get the graphical elements do I ?

    I dont know if i'm missing something small here.

    Anybody have any ideas?

    Thanks
    Patch
    Last edited by Patch21; Jun 2nd, 2005 at 08:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width