472,353 Members | 1,027 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 1711

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...
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...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.