473,800 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
5 3378
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*@christia n-hartmann.de> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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
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 getReplacementA nd(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
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*@christia n-hartmann.de> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.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 getReplacementA nd(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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2539
by: Saga | last post by:
Hi all, I just read the thread by the same name posted on Jun 15, 9:45 AM, but I am looking at it from a different point of view. I came across this question in terms of functionality. Are VB and C# (.NET) really functionally equivalent? I had read that although they are very similar, C# does extend functionality further than VB.NET; however, when I searched for pages regarding this, I could not find any.
5
4003
by: pcnerd | last post by:
I just recently got VB.NET 2005 Express Edition. How do I represent logic gates (AND, OR, NOT, etc.) in VB? I considered a function because functions return a value. For example, a 2-input AND gate function would have 2 input parameters & 1 output. But suppose that I want to build a "circuit" using different gates. I can't have a bunch of functions representing an AND gate. I don't want to have to create a separate function every time I...
2
6971
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
5
1810
by: Digital Puer | last post by:
Hi, I've inherited a bunch of C code that needs to be called from a C++ framework, so I thought it would be good to put these C functions into C++ classes for better organisation. What are best practices? Should I put related C functions into a class and make them static methods? Most of the C functions are in separate files with no global variables (one file of functions for producing random numbers, one file of functions for doing...
10
1237
by: not_a_commie | last post by:
Here is a list of features I've wanted in .NET as pulled from my lab notebook. If some of them are already there, maybe somebody could point them out to me. If you have an opinion positive or negative on any, I'd like to hear it. Thanks. They are in no particular order 1. GDI+::Graphics -draw a super ellipse 2. Add an attribute(s) similar to Obsolete for marking Dangerous, Advanced, or requiring Prerequisites on functions. 3. Add...
0
3672
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET. · When was the first version of .NET released? The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on...
0
3845
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which allows you to program accordingly. · What are user controls and custom controls? Custom controls: A control authored by a user or a third-party software vendor that...
1
3509
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets the ArrayList back from pgm3 how to extract and separate the fields out fo the ArrayLists? Question2: When pgm3 gets ArrayList back from pgm2 how to separate the
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.