Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Declare UserControl in a class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Zopers - 13 Feb 2008 09:43 GMT
Hello,

I have a UserControl with the name Toolbox, so the UserControl's class
name is UserControls_Toolbox.

I want to pass this UserControl to a function in another (static) class,
just as you would do with for example a string value:

For example:
string sValue = 'hello';
OtherStaticClass.FunctionName(sValue);

But the problem is that the UserControl's type is unkown in the static
class, so I can't make a function that expects the UserControl as a
parameter.

How can I make something like this:

public void FunctionName(UserControls_Toolbox tb)
{
}

In an aspx page this is not a problem, because in an aspx page I can
declare a variable of type UserControls_Toolbox, but in an other class
this seems not to be possible. Anyone got an idea?

Greetings,
Chris
bruce barker - 13 Feb 2008 19:40 GMT
define an interface (in appcode) that the user control implements. then you
can pass the interface to the static class

-- bruce (sqlwork.com)

> Hello,
>
[quoted text clipped - 26 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
gnewsgroup - 13 Feb 2008 20:08 GMT
On Feb 13, 2:40 pm, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> define an interface (in appcode) that the user control implements. then you
> can pass the interface to the static class
>
> -- bruce (sqlwork.com)

I am jumping into the conversation.  But, why can't we do this shown
below?

             UserControls_Toolbox tb

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.