473,788 Members | 3,053 Online
Bytes | Software Development & Data Engineering Community
+ 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:Syste m.dll,System.Da ta.dll,System.D rawing.dll,Syst em.Windows.Form s.dll,System.XM L.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:Fun ction 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.Plea se
see http://
// www.Planet-Source-Code.com/vb/scripts/Sh
// owCode.asp?txtC odeId=2553&lngW Id=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(ByV al 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(strDirt y, 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 1819

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.Funct ionName).

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
6299
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 passed to the function are strings or must be (automaticly converted to a string e.g. the number 10 should become the string "10". My problem is that I can only find samples and description of printf() like functions where the optional arguments and...
7
3787
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 records in Table3 have to contain all distinct records from Table1 and Table2 (records where Name2 and Address2 do not already exist in Table3) and Any help appreciated. I need these queries as a reference, I consider they
4
1468
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 following: //Users manage clients. When the system creates the client it must fetch the information from the DB and allow some modifications: Client client = new Client("test"); MasterAccount ma = new MasterAccount(1324651);
6
4904
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 the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
0
9655
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
9498
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
10363
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...
1
10110
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
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
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
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
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.