about custom component in ASP.net with VB.net

P

pepwelcome

Hi, here is a question about custom components.
====
Before I learn ASP.net I program with ASP and VBscript, and I write
codes like this:
"<script language=vbscript src="usercheck.vb">"
and so I can user the .vb file again and again.

I really want to know what to do in ASP.net, or if it is true that I
can only do it with an cumtom component. If I can only do this with
component, then how?

I have been trying to write a custom component this afternoon but
failled again and again.

Thanks for anyone's help!!!!
 
K

Karl Seguin [MVP]

It depends what usercheck.vb is doing. If it has a presentation/visual
element, either custom server controls or custom user controls (much easier)
are the way to go. If it's strictly code, simply add a new class file to
your project. Files in the same project as your web site are visible
throughout all your code.

Karl
 
J

Juan T. Llibre

Just open a command window ( cmd.exe );
make sure that the .Net Framework directory is in your path
( the .Net dir is where the vbc.exe compiler is located ) ;
navigate to the directory where you have your .vb files,
and run the compile command :

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

usercheck.dll will be created/compiled in the current directory.

Copy it to the /bin directory of your application and you can call its methods.

If you want to have VS.NET use it, reference it in your project.
 
P

pepwelcome

Please look at my codes:
-----------------------------
Imports System
Imports System.Web
Imports Microsoft.VisualBasic
Namespace Admins
Public Class myConst
Public ReadOnly Property homepage() As Integer
Get
Return 0
End Get
End Property
End Class
End Namespace
-----------------------------------------------
I compiled it and reference it to my project. When I try to use it this
way:
Dim ss As New Admins.myConst
VS.net says things like "cannot find myconst in namespace admins"!

I'm new to class developing , so some questions may sound silly :(((

Thanks a lot to Karl Seguin and Juan T. Llibre!!! ^o^

Owen Wong
 
O

Owen Wong

I'm using vs 2005.
Now I know why I always encounter the question: I put my .vb file in
the App_Code folder and compiled it to .dll and put the .dll file in
the BIN folder. That's why I always encounter an error. I think I can't
have the .vb file in the app_code folder and at the same time put the
compiled .dll file in the BIN folder. I sought through MSDN SDK and
didn't find an answer, but I guess I'm right, because when I moved the
..vb file and kept the .dll file or moved the .dll file and kept the .vb
file things were OK.

Thanks to you all the same! It's a great pleasure to know you guys! I'm
Owen Wong. :))))

PS: Why I can't use my name here? It always shows my email address. I
want to see my name here. ^_^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top