Using UserControls in a DLL

Discussion in 'ASP .Net Building Controls' started by Rory, Jul 28, 2003.

  1. Rory

    Rory Guest

    You need to create a refrence to the usercontrol project
    (assuming you created this in vs.net) in your current
    projects refrences. Alternatively, you could compile your
    user control into a dll (ie composite control).


    >-----Original Message-----
    >Hi all,
    >
    >Situation:
    >- Visual Studio 2002
    >- ASP.NET web project
    >- VB.NET
    >
    >I created some webforms with many controls (buttons,

    labels,
    >usercontrols,...) on it.
    >Every form has in its' load-event a functioncall to a

    function in an
    >external DLL.
    >The argument of that function is the "Me", the active

    form.
    >-------------
    >Private Sub Page_Load(ByVal sender As System.Object,

    ByVal e As
    >System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    > performExternalFunctionInDLL(Me)
    >End Sub
    >-------------
    >
    >In that function (DLL build in another solution), I need

    to modify the
    >properties of each control (fe. the colors or size).
    >This works for every standard control (button, label,

    radiobuttom,
    >hyperlinkcontrol,...) with a simple loop that checks

    every control on the
    >form and converts it to the TypeOf.
    >Fe. when found "textBox1", TypeOf "TextBox", "textBox1"

    will be converted to
    >"TextBox". Then I can modify the properties of that

    textbox.
    >Now I need to modify some properties of my userControl

    (properties I created
    >my own). It is possible to find that control, but when I

    want to convert it,
    >I can't convert to "myUserControl", so I need a reference

    or something.
    >"myUserControl" has only it's .ascx and .vb (using a

    codebehind-file) files,
    >but I can't import that into my external DLL. How can I

    use, import or
    >define "myUserControl" in my external project?
    >Anyone a suitable solution or suggestion for this problem?
    >
    >Thanks in advance!
    >
    >Sam
    >
    >
    >.
    >
     
    Rory, Jul 28, 2003
    #1
    1. Advertising

  2. Hi Rory,

    Thanks for your reply! I tried to add the two projects into one single
    solution, but this gives lots of "Dependency errors"... Both are totally
    different projects. I could make that reference, but none of the projects
    would run...
    Can you please tell me how I can make a DLL of a UserControl? How can this
    be done?

    Thanks agian!

    Sam


    "Rory" <> schreef in bericht
    news:04f001c354db$db02ca30$...
    > You need to create a refrence to the usercontrol project
    > (assuming you created this in vs.net) in your current
    > projects refrences. Alternatively, you could compile your
    > user control into a dll (ie composite control).
    >
    >
    > >-----Original Message-----
    > >Hi all,
    > >
    > >Situation:
    > >- Visual Studio 2002
    > >- ASP.NET web project
    > >- VB.NET
    > >
    > >I created some webforms with many controls (buttons,

    > labels,
    > >usercontrols,...) on it.
    > >Every form has in its' load-event a functioncall to a

    > function in an
    > >external DLL.
    > >The argument of that function is the "Me", the active

    > form.
    > >-------------
    > >Private Sub Page_Load(ByVal sender As System.Object,

    > ByVal e As
    > >System.EventArgs) Handles MyBase.Load
    > > 'Put user code to initialize the page here
    > > performExternalFunctionInDLL(Me)
    > >End Sub
    > >-------------
    > >
    > >In that function (DLL build in another solution), I need

    > to modify the
    > >properties of each control (fe. the colors or size).
    > >This works for every standard control (button, label,

    > radiobuttom,
    > >hyperlinkcontrol,...) with a simple loop that checks

    > every control on the
    > >form and converts it to the TypeOf.
    > >Fe. when found "textBox1", TypeOf "TextBox", "textBox1"

    > will be converted to
    > >"TextBox". Then I can modify the properties of that

    > textbox.
    > >Now I need to modify some properties of my userControl

    > (properties I created
    > >my own). It is possible to find that control, but when I

    > want to convert it,
    > >I can't convert to "myUserControl", so I need a reference

    > or something.
    > >"myUserControl" has only it's .ascx and .vb (using a

    > codebehind-file) files,
    > >but I can't import that into my external DLL. How can I

    > use, import or
    > >define "myUserControl" in my external project?
    > >Anyone a suitable solution or suggestion for this problem?
    > >
    > >Thanks in advance!
    > >
    > >Sam
    > >
    > >
    > >.
    > >
     
    Sam Vanderstraeten, Jul 28, 2003
    #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. Anushi
    Replies:
    5
    Views:
    8,770
  2. Jody Fisher

    Re: Using UserControls in a DLL

    Jody Fisher, Jul 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    437
    Sam Vanderstraeten
    Jul 29, 2003
  3. Krzysiek
    Replies:
    2
    Views:
    528
    Krzysiek
    Jul 5, 2004
  4. Giles Brown
    Replies:
    4
    Views:
    844
    Giles Brown
    Jul 30, 2003
  5. H. Simpson
    Replies:
    4
    Views:
    281
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page