How to add references to a aspx.vb file

How to add references to a aspx.vb file

Post by Nikolai Stoe » Sat, 01 Jun 2002 16:07:31



When you compile the WebForm1.aspx.vb add a /r:Test.dll switch.
Nikolai

>I have created a simple aspx.vb file as a code behind page in which I need
>to refencre a dll i created.    But upon compliation by ASP.NET it can't
>find my dll.  I have to add a refence to this some how.  It visual studio
>you can simple add a refence to the dll.  It mine case i'm doing this
>through command line compliers and notepad.  Can anybody tell me how to get
>my aspx.vb file to succeffuly complie so it will reference my dll

>thanks

>I have attached the code.

>To complie the Test.dll you can use this from the command prompt
>vbc /t:library Test.vb

>Public Class WebForm1
>    Inherits System.Web.UI.Page
>    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
>    Protected WithEvents Label1 As System.Web.UI.WebControls.Label

>    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

>    End Sub
>    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
>        Dim obj As Test.TestClass
>       Me.Label1.Text = obj.say()
>    End Sub
>End Class

>Namespace Test
>    Public Class TestClass
>        Sub New()

>        End Sub
>        Function SayHi() As String
>            Return "Hi"
>        End Function
>    End Class
>End Namespace

 
 
 

How to add references to a aspx.vb file

Post by Tren » Sat, 01 Jun 2002 23:47:34


Thanks..
 but that doesn't solve my problem.

I can complie the webform1.aspx.vb into a dll using the following
vbc /t:library /r:test.dll WebForm1.aspx.vb /r:system.dll /r:system.web.dll

but then how do get my WebForm1.aspx to point to this dll.  It still
refernce the WebForm1.aspx.vb page not the dll.  I think it has somehting to
do with the first line.

'WebForm1.aspx.vb

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <title>WebForm1</title>

 </HEAD>
 <body ms_positioning="GridLayout">
  <form id="Form1" method="post" runat="server">
   <asp:button id="Button1" style="Z-INDEX: 101; LEFT: 228px; POSITION:
absolute; TOP: 55px" runat="server" Width="117px" Height="40px"
Text="Button">
   </asp:button><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 374px;
POSITION: absolute; TOP: 56px" runat="server" Width="135px"
Height="41px">Label</asp:label>
  </form>
 </body>
</HTML>

thanks.. hope you can help


> When you compile the WebForm1.aspx.vb add a /r:Test.dll switch.
> Nikolai


> >I have created a simple aspx.vb file as a code behind page in which I
need
> >to refencre a dll i created.    But upon compliation by ASP.NET it can't
> >find my dll.  I have to add a refence to this some how.  It visual studio
> >you can simple add a refence to the dll.  It mine case i'm doing this
> >through command line compliers and notepad.  Can anybody tell me how to
get
> >my aspx.vb file to succeffuly complie so it will reference my dll

> >thanks

> >I have attached the code.

> >To complie the Test.dll you can use this from the command prompt
> >vbc /t:library Test.vb

> >Public Class WebForm1
> >    Inherits System.Web.UI.Page
> >    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
> >    Protected WithEvents Label1 As System.Web.UI.WebControls.Label

> >    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Init
Quote:

> >    End Sub
> >    Private Sub Button1_Click(ByVal sender As Object, ByVal e As

System.EventArgs) Handles Button1.Click

- Show quoted text -

Quote:> >        Dim obj As Test.TestClass
> >       Me.Label1.Text = obj.say()
> >    End Sub
> >End Class

> >Namespace Test
> >    Public Class TestClass
> >        Sub New()

> >        End Sub
> >        Function SayHi() As String
> >            Return "Hi"
> >        End Function
> >    End Class
> >End Namespace


 
 
 

How to add references to a aspx.vb file

Post by Nikolai Stoe » Sun, 02 Jun 2002 00:25:30


Just put the compiled dll to the <application_root>/bin folder and


compiler to the the /r switch when compiling the code=-behind file.

Nikolai


>Thanks..
> but that doesn't solve my problem.

>I can complie the webform1.aspx.vb into a dll using the following
>vbc /t:library /r:test.dll WebForm1.aspx.vb /r:system.dll /r:system.web.dll

>but then how do get my WebForm1.aspx to point to this dll.  It still
>refernce the WebForm1.aspx.vb page not the dll.  I think it has somehting to
>do with the first line.

>'WebForm1.aspx.vb

><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><HTML>
> <HEAD>
>  <title>WebForm1</title>

> </HEAD>
> <body ms_positioning="GridLayout">
>  <form id="Form1" method="post" runat="server">
>   <asp:button id="Button1" style="Z-INDEX: 101; LEFT: 228px; POSITION:
>absolute; TOP: 55px" runat="server" Width="117px" Height="40px"
>Text="Button">
>   </asp:button><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 374px;
>POSITION: absolute; TOP: 56px" runat="server" Width="135px"
>Height="41px">Label</asp:label>
>  </form>
> </body>
></HTML>

>thanks.. hope you can help



>>When you compile the WebForm1.aspx.vb add a /r:Test.dll switch.
>>Nikolai


>>>I have created a simple aspx.vb file as a code behind page in which I

>need

>>>to refencre a dll i created.    But upon compliation by ASP.NET it can't
>>>find my dll.  I have to add a refence to this some how.  It visual studio
>>>you can simple add a refence to the dll.  It mine case i'm doing this
>>>through command line compliers and notepad.  Can anybody tell me how to

>get

>>>my aspx.vb file to succeffuly complie so it will reference my dll

>>>thanks

>>>I have attached the code.

>>>To complie the Test.dll you can use this from the command prompt
>>>vbc /t:library Test.vb

>>>Public Class WebForm1
>>>   Inherits System.Web.UI.Page
>>>   Protected WithEvents Button1 As System.Web.UI.WebControls.Button
>>>   Protected WithEvents Label1 As System.Web.UI.WebControls.Label

>>>   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As

>System.EventArgs) Handles MyBase.Init

>>>   End Sub
>>>   Private Sub Button1_Click(ByVal sender As Object, ByVal e As

>System.EventArgs) Handles Button1.Click

>>>       Dim obj As Test.TestClass
>>>      Me.Label1.Text = obj.say()
>>>   End Sub
>>>End Class

>>>Namespace Test
>>>   Public Class TestClass
>>>       Sub New()

>>>       End Sub
>>>       Function SayHi() As String
>>>           Return "Hi"
>>>       End Function
>>>   End Class
>>>End Namespace

 
 
 

How to add references to a aspx.vb file

Post by Tren » Sun, 02 Jun 2002 01:07:05


Hello Nikolai

I'm almost there. I just think I might have typed something in wrong.  I tried you first suggest by taking out the src="" tag from the directive and placing the complied dll in the bin folder.   The asp.net complains that it can't load type WebForm1..

this is the new directive that I provided with the dll in the bin directory.




but I get the same error.  

anymore help

thanks

PS. If it could help i could post or send you a zip file of my folder layout and files.




  Nikolai

Thanks..
 but that doesn't solve my problem.

I can complie the webform1.aspx.vb into a dll using the following
vbc /t:library /r:test.dll WebForm1.aspx.vb /r:system.dll /r:system.web.dll

but then how do get my WebForm1.aspx to point to this dll.  It still
refernce the WebForm1.aspx.vb page not the dll.  I think it has somehting to
do with the first line.

'WebForm1.aspx.vb

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <title>WebForm1</title>

 </HEAD>
 <body ms_positioning="GridLayout">
  <form id="Form1" method="post" runat="server">
   <asp:button id="Button1" style="Z-INDEX: 101; LEFT: 228px; POSITION:
absolute; TOP: 55px" runat="server" Width="117px" Height="40px"
Text="Button">
   </asp:button><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 374px;
POSITION: absolute; TOP: 56px" runat="server" Width="135px"
Height="41px">Label</asp:label>
  </form>
 </body>
</HTML>

thanks.. hope you can help


When you compile the WebForm1.aspx.vb add a /r:Test.dll switch.
Nikolai

I have created a simple aspx.vb file as a code behind page in which I

need

to refencre a dll i created.    But upon compliation by ASP.NET it can't
find my dll.  I have to add a refence to this some how.  It visual studio
you can simple add a refence to the dll.  It mine case i'm doing this
through command line compliers and notepad.  Can anybody tell me how to

get

my aspx.vb file to succeffuly complie so it will reference my dll

thanks

I have attached the code.

To complie the Test.dll you can use this from the command prompt
vbc /t:library Test.vb

Public Class WebForm1
   Inherits System.Web.UI.Page
   Protected WithEvents Button1 As System.Web.UI.WebControls.Button
   Protected WithEvents Label1 As System.Web.UI.WebControls.Label

   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Init

   End Sub
   Private Sub Button1_Click(ByVal sender As Object, ByVal e As

System.EventArgs) Handles Button1.Click

       Dim obj As Test.TestClass
      Me.Label1.Text = obj.say()
   End Sub
End Class

Namespace Test
   Public Class TestClass
       Sub New()

       End Sub
       Function SayHi() As String
           Return "Hi"
       End Function
   End Class
End Namespace

 
 
 

How to add references to a aspx.vb file

Post by Somu » Tue, 09 Jul 2002 23:28:55


Referencing Dll has to be done by 2 steps.

Step1: Add the DLL in the References
    From the Solution explorer , right click on the references, add the dll ....., select the dll file. The files will be in the
      <DllProject>\Bin\Debug\

Step2: Include the Namespace in your aspx.
   Goto Code behind of the ASPX page.add the following code at top.
  VB.Net :
        Imports <DllNameSpace>
   C#:
        using <DllNameSpace>

Then use the class in your aspx page.
  Vb.Net:
        Dim myClass as New <ClassName>

        myClass.<Method>

Hope this helps. Let me know.  

Somu

  Hello Nikolai

  I'm almost there. I just think I might have typed something in wrong.  I tried you first suggest by taking out the src="" tag from the directive and placing the complied dll in the bin folder.   The asp.net complains that it can't load type WebForm1..

  this is the new directive that I provided with the dll in the bin directory.




  but I get the same error.  

  anymore help

  thanks

  PS. If it could help i could post or send you a zip file of my folder layout and files.




    Nikolai


Thanks..
 but that doesn't solve my problem.

I can complie the webform1.aspx.vb into a dll using the following
vbc /t:library /r:test.dll WebForm1.aspx.vb /r:system.dll /r:system.web.dll

but then how do get my WebForm1.aspx to point to this dll.  It still
refernce the WebForm1.aspx.vb page not the dll.  I think it has somehting to
do with the first line.

'WebForm1.aspx.vb

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <title>WebForm1</title>

 </HEAD>
 <body ms_positioning="GridLayout">
  <form id="Form1" method="post" runat="server">
   <asp:button id="Button1" style="Z-INDEX: 101; LEFT: 228px; POSITION:
absolute; TOP: 55px" runat="server" Width="117px" Height="40px"
Text="Button">
   </asp:button><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 374px;
POSITION: absolute; TOP: 56px" runat="server" Width="135px"
Height="41px">Label</asp:label>
  </form>
 </body>
</HTML>

thanks.. hope you can help


When you compile the WebForm1.aspx.vb add a /r:Test.dll switch.
Nikolai

I have created a simple aspx.vb file as a code behind page in which I

need

to refencre a dll i created.    But upon compliation by ASP.NET it can't
find my dll.  I have to add a refence to this some how.  It visual studio
you can simple add a refence to the dll.  It mine case i'm doing this
through command line compliers and notepad.  Can anybody tell me how to

get

my aspx.vb file to succeffuly complie so it will reference my dll

thanks

I have attached the code.

To complie the Test.dll you can use this from the command prompt
vbc /t:library Test.vb

Public Class WebForm1
   Inherits System.Web.UI.Page
   Protected WithEvents Button1 As System.Web.UI.WebControls.Button
   Protected WithEvents Label1 As System.Web.UI.WebControls.Label

   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Init

   End Sub
   Private Sub Button1_Click(ByVal sender As Object, ByVal e As

System.EventArgs) Handles Button1.Click

       Dim obj As Test.TestClass
      Me.Label1.Text = obj.say()
   End Sub
End Class

Namespace Test
   Public Class TestClass
       Sub New()

       End Sub
       Function SayHi() As String
           Return "Hi"
       End Function
   End Class
End Namespace

 
 
 

1. From .aspx files to get .aspx.vb files

Hello Friends,

I am using VB.NET in Visual Studio.net to program ASP.NET application.
Somebody has written many .aspx files using Notepad.  The language in these
files is VB.NET.  I need to add and modify these files in my web application.  For example, I need to add buttons and write the VB.net code for the buttons.  When load them in Visual Studio.net, there are no .aspx.vb forms.  Is there a way to generate .aspx.vb forms for them?  Must I modify the html code to modify them?  

Thank you very much!!!

Chris Ma

2. iso9660 and NT4

3. ASP.Net Referencing a VB code file from a VB code file

4. newbie needs help!

5. How do a add a Reference to the "Add Reference" dialog box

6. Servo Speed

7. reference a control in an aspx from a ascx.vb

8. Problem with Personalities

9. How to add reference to System.Management in ASPX/Codebehind?

10. Referencing a property within a dynamically added Usercontrol during aspx Page_Load event

11. Problem referencing C# defined constant from VB.NET in ASPX page

12. Add VB File in sourcesafe : Error while reading file

13. Error CS2011 when adding web reference vb.net