text: Re: How to share VB code across multiple pages?
  - From: antonyliu2002@xxxxxxxxx
  - Date: 29 Sep 2005 09:33:12 -0700
  Hi, Juan,
  Yes, I am using ASP.NET 1.1. I tried compiling MyClass.vb using
  vbc.exe, but got an error message as follows:
  "The application has failed to start because MSVCR71.dll was not
  found.Reinstalling this application may fix this problem"
  But MSVCR71.dll is actually right there under the folder
  Windows\Microsoft.NET\Framework\v1.1.4322. How to fix this please?
  By the way, how to get ASP.NET 2.0? Is it freely upgradable?
  Juan T. Llibre wrote:
  > If you're using ASP.NET 2.0, place MyClass.vb
  > in the App_Code folder. You'll be able to access it there.
  >
  > If you're using ASP.NET 1.1, you should command-line compile
  > MyClass.vb to MyClass.dll and place it in the /bin drectory.
  >
  > You, then, can import the namespace in your aspx file with :
  > <%@ Import Namespace="YourNameSpaceName" %>
  > and instantiate your classes from any aspx page.
  >
  >
  >
  > Juan T. Llibre, ASP.NET MVP
  > ASP.NET FAQ :
  > Foros de ASP.NET en Español :
  > ======================================
  > <antonyliu2002@xxxxxxxxx> wrote in message
  > news:1127931941.719998.234850@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  > > Hi, Thx.
  > >
  > > After I got your reply, then I created a file called "MyClass.vb" in
  > > the same folder of the webpages.
  > >
  > > MyClass.vb has a Class like this:
  > >
  > > Public Class MyClass
  > > Public Sub MySub()
  > > Do Something
  > > End Sub
  > > End Class
  > >
  > > I called the MySub like this in my webpage:
  > >
  > > Call MyClass.MySub()
  > >
  > > This is the compile error:
  > >
  > > BC30456: 'MySub' is not a member of 'ASP.Page1_aspx'.
  > >
  > > Apparently I did not do it in the right way. I think I am doing it
  > > like Java. I was a Java programmer.
  > >
  > > Shouldn't I tell Page1.aspx where to find that function?
  > >
  > > darrel wrote:
  > >> > A bunch of web pages of mine need the same function. Right now, I put
  > >> > the Subs in each individual page.
  > >> >
  > >> > I think there must be a way to save my Subs in a separate file and then
  > >> > have each web page link to it. Could you guys please let me know how
  > >> > to do this? Thanks a lot!
  > >>
  > >> There are a variety of ways. One way is to just make a new class file (a .vb
  > >> or .cs file) and then reference the function that way.
  > >>
  > >> I typically make a new class file called sharedFunctions and then put
  > >> specific functions within it. I can then reference them from any file in the
  > >> project: sharedFunctions.myFunction()
  > >>
  > >> -Darrel
  > >
  .
  - References:
  - Re: How to share VB code across multiple pages?
  - From: antonyliu2002
  - Re: How to share VB code across multiple pages?
  - From: Juan T. Llibre
  - Prev by Date: Re: IStateManager in a class object
  - Next by Date: Re: Setting SelectedIndex problems
  - Previous by thread: Re: How to share VB code across multiple pages?
  - Next by thread: Re: How to share VB code across multiple pages?
  - Index(es):