Starting with VB.NET: (Client-side) ActiveX for web applications
Hello guys,
I'm a bloody VB.NET beginner, so please bear with me and don't laught too loud about me and my small problems ... :-)
I used to develop "Classic ASP" and "VB 6.0" applications for some years. During that time I created some server-side ActiveX controls for my Classic ASP web applications. Nothing special: small Visual Basic *.DLLs including some "public functions" I could use in my ASP code - features like ftp connect or reading out server-side system informations (for example).
Now I'm going to use ActiveX for client-side purposes: I want to create some *.DLLs to enrich my client-side browser code ... I need some special features which are not included in JavaScript. First let me say: security is not a problem. The web sites I talk about are intranet applications, the browser which is used in my company is the Internet Explorer and the IE security settings for these web sites are appropriately configured.
Some weeks ago I attended a VB.NET training for beginners. Unfortunately in this training there was no time enough to speak about the theme "Creating Class Libraries". So I started learning alone ... but without any appreciable success. Nothing works!
I wanted to start creating a simple Visual Basic *.DLL including a simple function adding two integer values (committed as the functions' parameters) and giving the result back as the "return" value.
Now please watch this. It's the VB code from my DLL:
--------------------------------------------------------------------------
Public Class schroeders_class
Public Function schroeders_function(ByVal var_integer_01 As Integer, _
ByVal var_integer_02 As Integer)
schroeders_function = var_integer_01 + var_integer_02
End Function
End Class
--------------------------------------------------------------------------
First I tried to register my DLL using this command:
regsvr32.exe schroeders_lib.dll
But nothing worked! A (german) error message appeared:
schroeders_lib.dll wurde geladen, aber
der DllRegisterServer-Eingangspunkt
wurde nicht gefunden.
Diese Datei kann nicht registriert werden.
After this I tried to call my DLL and my function within a simple HTML file using VBScript:
--------------------------------------------------------------------------
<script language="VBScript">
Set var_activexobject = CreateObject("schroeders_lib.schroeders_class")
var_result = var_activexobject.schroeders_function(1, 2)
msgbox var_result
Set var_activexobject = nothing
</script>
--------------------------------------------------------------------------
Parsing my HTML file and running the VBScript code a german error message appeared in my browser:
ActiveX-Komponenten kann kein Objekt
erstellen: 'schroeders_lib.schroeders_class'
First question: Is my Visual Basic DLL code okay and if not, what's wrong?
(I wrote the code like I used in VB6.0.)
Second question: Why does the DLL cannot be registered?
Third question: The VBScript code in my HTML file - Do I call the DLL function correctly?
I'm so depressed because nothing works - not even the simplest example.
And I have no idea why.
Can you help me?
Best regards
Tommy