ASP.net (vb.net) Sub routine that can be used throughout the application

Hello Guru's!

How can I create a subroutine in asp.net\vb.net that I can use throughout my application?

For example,

I want to create a usercontrol that I can use as a standard tool bar on all of my pages that let's you know who is logged in and give the logoff button option.

How would I do this?

Thanks in advance!
abennett10Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nayernaguibCommented:
Assuming that you already have created the control, you have to do the following:

1. In the Page_Load method of each page, create a new instance of the control, and then add the control to the page.
2. You can store user information in session variables, so that any page throughout the application can access the information and use it to display data on the control.

_______________

  Nayer Naguib
Jeff CertainCommented:
The user control should be created as an ascx file (a "user control" file). You can then drag the user control onto any (or all) of your pages (assuming you're using Visual Studio). This will register the control in the HTML portion of your page, and instantiate the control.

BTW: generally, you should post to the ASP .Net topic area for ASP .net questions.... :)
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

abennett10Author Commented:
Sorry about that, I'll make sure I post this in the asp.net section of the forum.

What code do I use to create a new instance of the control, and make sure that it is sized how I needed?
Jeff CertainCommented:
Drag-and-drop in VS, as mentioned above. That creates the control for you. Since your ascx control will inherit from web.ui.controls (by deafult), it will have a height and width exposed. Alterately, you can set the size of the user control's child controls in the user control...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
abennett10Author Commented:
I will give that a try!

Thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.