473,474 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Make dll that contain one function. Help Please.

Vb.Net Make dll that contain one function. Help Please.
I would like to call a function from different applications.
I think i have to make a dll.
I have Visual Basic.net 2003 Standard Edition, that teorically does
not make dll,
but pratically does.

I search vbc.exe and copy it to a new folder, in which i have the
following batch file

Make a New folder.
Search "vbc.exe" and Copy it to the new folder.
Make a new Batch file, whith the following code and name it
"Create_Dll.bat:

Create_Dll.bat
"vbc.exe" /target:library /out:My_dll
/reference:System.dll,System.Data.dll,System.Drawin g.dll,System.Windows.Forms.dll,System.XML.dll
"My_Code.vb"
pause

Of course "My_Code.vb" contains the dll code.
I would like to put there a function i can call from any application.

Just as example there is a simple function by: Tom Harris at the
following address
http://www.planet-source-code.com/vb...2553&lngWId=10
that removes unwanted chars.
using that function as example how would the code be in "My_Code.vb" ?
Can somebody help ?

Best Regards.

Robert.



Following the code by Tom Harris,
from http://www.planet-source-code.com/vb...2553&lngWId=10

//**************************************
//
// Name: Clean Unwanted Characters From
// a String
// Description:Function to clean all cha
// racters but A-Z, a-z, and 0123456789. Wh
// en I don't use Regular Expressions I use
// this function to put only the characters
// I want into a string. It is very useful
// for password generation. Look up the Dec
// number on an ASCII chart and use this fo
// r many things.
// By: Tom Harris
//
// Inputs:The string you want to remove
// unwanted characters from
//
// Returns:A String with only A-Z, a-z,
// and 0-9 charactes
//
// Assumes:You will need an ASCII chart
// to look up the DEC values associated wit
// h the ASCII character if you want to mod
// ify the specific chars stripped.
http://www.asciitable.com is a good resource.
//
//This code is copyrighted and has // limited warranties.Please
see http://
// www.Planet-Source-Code.com/vb/scripts/Sh
// owCode.asp?txtCodeId=2553&lngWId=10 //for details.
//**************************************
//

'Function to clean all characters but A-Z, a-z, and 0123456789
'When I don't use Regular Expressions I use this function to put
'only the characters I want into a string. It is very useful
'for password generation. Look up the Dec number on an ASCII
'chart and use this for many things.

Public Function CleanString(ByVal strDirty As String) As String

Dim strLen As String
Dim strCounter As Integer
Dim strClean As String

strLen = strDirty.Length
strClean = ""
For strCounter = 1 To strLen
Select Case Asc(Mid(strDirty, strCounter, 1))
Case 65 To 90 'A-Z
strClean = strClean & Mid(strDirty, strCounter, 1)
Case 97 To 122 'a-z
strClean = strClean & Mid(strDirty, strCounter, 1)
Case 48 To 57 ' 0123456789
strClean = strClean & Mid(strDirty, strCounter, 1)
Case Else
'All other characters are stripped out
End Select
Next

Return LCase(strClean)

End Function
Nov 21 '05 #1
1 1780

The OOP way to do it would be to make the function a shared function
on some class and import the class's namespace in the calling code
(where the calls will be ClassName.FunctionName).

The VB6 way to do it would be to put the function inside a module and
then import the module in the calling code (calls will be just
FunctionName).

HTH,

Sam

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Kapt. Boogschutter | last post by:
I'm trying to create a function that has at least 1 Argument but can also contain any number of Arguments (except 0 because my function would have no meaning for 0 argument). The arguments...
7
by: Nicolae Fieraru | last post by:
I have two tables, they contain: Table1: ID1, Name1, Address1, Purchase1 Table2: ID2, Name2, Address2, Purchase2 I need a query which creates Table3 with content from Table1 and Table2. The...
4
by: hufel | last post by:
Hi, I'm doing my first big project in C# and I'm stuck with a problem that I believe has a simple and efficient solution for it (I just haven't bumped into it yet...). The concept is the...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.