By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

[VB.NET]: Extract functions into a separate class/namespace - How?

P: n/a
cha
Hi there,

I wonder what the best way would be to extract some basic functions
into a separate class/namespace and make them accessible for a
ASP.NET-Page (aspx) and a NET-WebService (asmx). Both files are written
in VB.NET

Is there a detailled description somewhere existing in the Internet of
how to do the extraction of basic funtions into a separate
class/namespace and use this new class/namespace then within a ASP.NET
and a NET-WebService file ?

Thank you very much for any help in advance,

Christian

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
This is very simple to do.

Just create a "Class Library" project and build your class with whatever
methods needed. Compile this project.

The assembly that you just created is now available to ANY kind of .NET
project (written in ANY .NET language) by simply making a reference to this
assembly from your project.

That's it.

<ch*@christian-hartmann.de> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi there,

I wonder what the best way would be to extract some basic functions
into a separate class/namespace and make them accessible for a
ASP.NET-Page (aspx) and a NET-WebService (asmx). Both files are written
in VB.NET

Is there a detailled description somewhere existing in the Internet of
how to do the extraction of basic funtions into a separate
class/namespace and use this new class/namespace then within a ASP.NET
and a NET-WebService file ?

Thank you very much for any help in advance,

Christian

Nov 21 '05 #2

P: n/a
cha
First of all, thanks for your help. This sounds to be rather easy...

However, if I have created a file called XMLHelper.vb like that

Namespace HWFHelper
Public Class XMLHelper
Public Function getReplacementAnd(ByVal text As String) As
String
....
End Function
End Class
End Namespace

The compiler has done it's job and I was able to add it to the .NET
onfiguration as a .NET assembly.

But how do I reference this new class/namespace within my asmx-File
using Notepad?

Imports HWFHelper

leads to an 'BC30466'-Error (Namespace or Typ 'HWFHelper' for import
'HWFHelper' not found).

So, what am I doing wrong here?

Regards,

Christian

Nov 21 '05 #3

P: n/a
You need to make a reference to an assembly before you can use it in any way
(i.e. an Imports statement).

I don't know what code you need to add since I use VS.NET. First of all,
place the assembly in your project's bin folder. You may try adding this:
<% @Assembly Src="myData.vb"%> to the .asmx file.


<ch*@christian-hartmann.de> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
First of all, thanks for your help. This sounds to be rather easy...

However, if I have created a file called XMLHelper.vb like that

Namespace HWFHelper
Public Class XMLHelper
Public Function getReplacementAnd(ByVal text As String) As
String
....
End Function
End Class
End Namespace

The compiler has done it's job and I was able to add it to the .NET
onfiguration as a .NET assembly.

But how do I reference this new class/namespace within my asmx-File
using Notepad?

Imports HWFHelper

leads to an 'BC30466'-Error (Namespace or Typ 'HWFHelper' for import
'HWFHelper' not found).

So, what am I doing wrong here?

Regards,

Christian

Nov 21 '05 #4

P: n/a
Christian,

As you do it as Scott tells and make a DLL from it, than you can reference
to it as to any other DLL in your application.

This kind of notebook programming are often done in the newsgroup aspnet.

Maybe can you look self for the exact or maybe other solution in that
newsgroup.

Aspnet
news://msnews.microsoft.com/microsof...amework.aspnet

Web interface:
http://communities2.microsoft.com/co...amework.aspnet

I hope this helps a little bit?

Cor
Nov 21 '05 #5

P: n/a
cha
Dear Scott,

thank you very much for your help.

The

<% @Assembly Src="myData.vb"%>

is exactly what I have been looking for.

Now everything works properly!

Regards,

Christian

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.