Solved

how do I use an include file in vb code behind in asp.net

Posted on 2011-03-10
3
239 Views
Last Modified: 2012-05-11
seems simple...all I want to do is have an 'include' file for a set of common code in my vbscript code behinds.
0
Comment
Question by:d2fox
  • 2
3 Comments
 
LVL 51

Expert Comment

by:HainKurt
Comment Utility
include is over :)

use a shared class and put all your shared code here and use them whenever you want...
0
 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
Comment Utility
or create a base page and put all your shared code into this base page
then all your web pages will inherit from this base, so they can use the sahred codes...

right now you are inheriting them from

    Inherits System.Web.UI.Page

see sample code
Partial Class myBasePage
    Inherits System.Web.UI.Page

    public function f1()...
    public sub s1()...
End Class

Partial Class Page1
    Inherits myBasePage
...
End Class

Partial Class Page2
    Inherits myBasePage
...
End Class

Open in new window

0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
Was going to comment but then noticed you have already been given the perfect answer.
Shared Classes are the way to go.
If you do decide to go for the basepage option just an addition to Hain Kurt's excellent answer is that your basepage.vb file would go in your web sites app_code folder at the root of the website as putting it in here will mean it gets precompiled.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now