Professional Web Applications Themes

Using UserControls in a DLL - ASP.NET Building Controls

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) ...

  1. #1

    Default Using UserControls in a DLL

    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 Guest

  2. #2

    Default Re: Using UserControls in a DLL

    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" <roryvivid-design.com.au> schreef in bericht
    news:04f001c354db$db02ca30$a101280aphx.gbl...
    > 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 Guest

  3. #3

    Default Re: Using UserControls in a DLL

    I think you need to expose the control's properties in the dll in order to
    do this

    Jody

    "Sam Vanderstraeten" <samno.spam> wrote in message
    news:efLhSdNVDHA.2508TK2MSFTNGP12.phx.gbl...
    > 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
    >
    >

    Jody Fisher Guest

  4. #4

    Default Re: Using UserControls in a DLL

    I think you need to expose the control's properties in the dll in order to
    do this

    Jody

    "Sam Vanderstraeten" <samno.spam> wrote in message
    news:efLhSdNVDHA.2508TK2MSFTNGP12.phx.gbl...
    > 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
    >
    >

    Jody Fisher Guest

  5. #5

    Default Re: Using UserControls in a DLL

    Hi Jody,

    The problem is that there are no graphical elements in a DLL Class
    Library... How can I compile an ASCX into a DLL? I tried to make a
    reference, but I can't link to an ASCX-file. When I combine the two
    solutions into one solution, it is possible to reach my UserControl's
    properties, but I always get a dependency-error. My first project uses
    functions of solution two and solutions two uses functions of solution
    one...
    The error-messages I got is:
    ---------------
    Error: The dependency 'ClassWebFormConfig, Version=1.0.1279.18629,
    Culture=neutral' in project 'ClassWebFormConfig' cannot be copied to the run
    directory because it would conflict with dependency 'ClassWebFormConfig,
    Version=1.0.1303.25199, Culture=neutral'
    --------------

    Thanks again,

    Sam

    "Jody Fisher" <jfisherclaytonutz.com> -
    news:e1flL7VVDHA.2544tk2msftngp13.phx.gbl...
    > I think you need to expose the control's properties in the dll in order to
    > do this
    >
    > Jody
    >
    > "Sam Vanderstraeten" <samno.spam> wrote in message
    > news:efLhSdNVDHA.2508TK2MSFTNGP12.phx.gbl...
    > > 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 Guest

  6. #6

    Default Re: Using UserControls in a DLL

    Hi Jody,

    The problem is that there are no graphical elements in a DLL Class
    Library... How can I compile an ASCX into a DLL? I tried to make a
    reference, but I can't link to an ASCX-file. When I combine the two
    solutions into one solution, it is possible to reach my UserControl's
    properties, but I always get a dependency-error. My first project uses
    functions of solution two and solutions two uses functions of solution
    one...
    The error-messages I got is:
    ---------------
    Error: The dependency 'ClassWebFormConfig, Version=1.0.1279.18629,
    Culture=neutral' in project 'ClassWebFormConfig' cannot be copied to the run
    directory because it would conflict with dependency 'ClassWebFormConfig,
    Version=1.0.1303.25199, Culture=neutral'
    --------------

    Thanks again,

    Sam

    "Jody Fisher" <jfisherclaytonutz.com> -
    news:e1flL7VVDHA.2544tk2msftngp13.phx.gbl...
    > I think you need to expose the control's properties in the dll in order to
    > do this
    >
    > Jody
    >
    > "Sam Vanderstraeten" <samno.spam> wrote in message
    > news:efLhSdNVDHA.2508TK2MSFTNGP12.phx.gbl...
    > > 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 Guest

Similar Threads

  1. UserControls in a different directory
    By Nathan Sokalski in forum ASP.NET Building Controls
    Replies: 3
    Last Post: September 26th, 05:55 PM
  2. UserControls ASP.NET 2.0
    By Giovanni in forum ASP.NET Building Controls
    Replies: 0
    Last Post: April 24th, 11:16 PM
  3. Web UserControls and databinding...
    By fahad in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 2nd, 07:30 AM
  4. Abstract Usercontrols
    By tobiwan_kenobi in forum ASP.NET Building Controls
    Replies: 0
    Last Post: June 2nd, 11:05 PM
  5. Recursive UserControls? Are they possible?
    By Nathan in forum ASP.NET Building Controls
    Replies: 0
    Last Post: June 22nd, 01:18 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139