Re: Very Confused: Class, Imports, ...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Shapper,

what you need to do is compile common.vb to common.dll using the
command-line compiler (vbc.exe) and reference *that* in your VS.NET project.

vbc /t:library /out:common.dll common.vb

If you need to import .Net classes, include them in your command line:
vbc /t:library /r:system.dll /r:system.web.dll /out:common.dll common.vb

Once your assembly ( common.dll ) is compiled,
place it in the /bin directory of your application
and you will be able to call any of its functions.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:%23R6LUt2ZFHA.3864@xxxxxxxxxxxxxxxxxxxxxxx
> Hello,
>
> I am working in a web site where all the code is placed in aspx.vb files.
> After a while I realized that many functions included in my aspx.vb files where common
> to all pages.
>
> I created a new file named common.vb where I created a class named common and where I
> place all common functions:
>
> Imports System
>
> Public Class Common
> Public Shared Sub MyFunction01()
> ...
> End Sub
> ... End Class
>
> In my aspx.vb file I have:
>
> Imports Common
>
> Public Class myPage
>
> Inherits System.Web.UI.Page
> Private Sub Page_Load(
> MyFunction01()
> End Sub
>
> This is all I have. I get the error:
> Namespace or Type 'common' for the Imports 'common' cannot be found.
>
> Basically all I need is to use Common functions in my aspx pages class.
>
> Can someone tell me specifically what am I doing wrong?
>
> Thanks,
> Miguel
>
>


.



Relevant Pages

  • Re: QBasic 1.1 language
    ... I think NAMED common does, ... That also tells you that the IDE uses up about 350K bytes of space. ... The big one is way WAY too big to actually compile with BC. ... There was a remark flag to indicate if a SUB was overlayable. ...
    (comp.lang.basic.misc)
  • Re: Very Confused: Class, Imports, ...
    ... Is it possible to use the command-line compiler without needing to install Visual Studio? ... > After a while I realized that many functions included in my aspx.vb files where common> to all pages. ... > Public Shared Sub MyFunction01() ... > Basically all I need is to use Common functions in my aspx pages class. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Very Confused: Class, Imports, ...
    ... Isn't it possible to make this work without compiling the common.vb? ... > After a while I realized that many functions included in my aspx.vb files where common> to all pages. ... > Public Shared Sub MyFunction01() ... > Basically all I need is to use Common functions in my aspx pages class. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: QBasic 1.1 language
    ... I think NAMED common does, ... the IDE when you weer adding code to a program. ... The big one is way WAY too big to actually compile with BC. ... My source files were huge because they contained all the SUBS. ...
    (comp.lang.basic.misc)
  • Re: Events
    ... Protected Sub OnFoo ... The in your code you woudl just declare a common object, ... > Public Event Type_Changed ... > Private Sub UC_Z3_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)