473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Creating an object from a DLL

Hi

I have a DLL which was created using MFC (and set to Automation). In this
DLL there a class called MyTestClass. My question is, how do I create an
object of this class from within a vb.net application?

Thanks in advance

Geoff
Nov 21 '05 #1
4 1448
Q
Hello Geoff,

you first have to add your DLL-file to the references of your project.

Then add code to your application as shown below.
In the example the DLL-file is called MyDLL. In this DLL-file there is a class named MyTestClass and in this class there is
a function named MultiplyThis which returns a result.

Example:

Imports [MyDLL]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyProcedures As New MyTestClass
Dim Result As Integer
Result = MyProcedures.MultiplyThis(2, 5)
End Sub

Hope this helps!

Regards,

Q

"Geoff Jones" <no********@email.com> wrote in message news:41***********************@news.dial.pipex.com ...
Hi

I have a DLL which was created using MFC (and set to Automation). In this
DLL there a class called MyTestClass. My question is, how do I create an
object of this class from within a vb.net application?

Thanks in advance

Geoff

Nov 21 '05 #2
Q
Hello Geoff,

you first have to add your DLL-file to the references of your project.

Then add code to your application as shown below.
In the example the DLL-file is called MyDLL. In this DLL-file there is a class named MyTestClass and in this class there is
a function named MultiplyThis which returns a result.

Example:

Imports [MyDLL]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyProcedures As New MyTestClass
Dim Result As Integer
Result = MyProcedures.MultiplyThis(2, 5)
End Sub

Hope this helps!

Regards,

Q

"Geoff Jones" <no********@email.com> wrote in message news:41***********************@news.dial.pipex.com ...
Hi

I have a DLL which was created using MFC (and set to Automation). In this
DLL there a class called MyTestClass. My question is, how do I create an
object of this class from within a vb.net application?

Thanks in advance

Geoff

Nov 21 '05 #3
I seem to remember reading in one of the notes on this newsgroup that DLL's
created with MFC couldn't be used with .Net applications. I could be wrong
but if your DLL doesn't work, you might want to look at this possibility.

"Geoff Jones" wrote:
Hi

I have a DLL which was created using MFC (and set to Automation). In this
DLL there a class called MyTestClass. My question is, how do I create an
object of this class from within a vb.net application?

Thanks in advance

Geoff

Nov 21 '05 #4
I seem to remember reading in one of the notes on this newsgroup that DLL's
created with MFC couldn't be used with .Net applications. I could be wrong
but if your DLL doesn't work, you might want to look at this possibility.

"Geoff Jones" wrote:
Hi

I have a DLL which was created using MFC (and set to Automation). In this
DLL there a class called MyTestClass. My question is, how do I create an
object of this class from within a vb.net application?

Thanks in advance

Geoff

Nov 21 '05 #5

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

Similar topics

8
by: mcmg | last post by:
Hi, I have an asp app that works fine on a windows xp machine but does not work on a windows 2000 server. I have the following code in my global.asa: <OBJECT RUNAT=Server SCOPE=SESSION...
6
by: Davinci_Jeremie | last post by:
Hi Newbee here to C# I have a simple questions... In a Hello world example how does the class object Hello exist with out creating it? I come from object pascal where everything object is...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
16
by: tshad | last post by:
This is a little complicated to explain but I have some web services on a machine that work great. The problem is that I have run into a situation where I need to set up my program to access one...
17
by: Lee Harr | last post by:
I understand how to create a property like this: class RC(object): def _set_pwm(self, v): self._pwm01 = v % 256 def _get_pwm(self): return self._pwm01 pwm01 = property(_get_pwm, _set_pwm)
6
by: wcc | last post by:
Hello, How do I create a class using a variable as the class name? For example, in the code below, I'd like replace the line class TestClass(object): with something like class...
2
by: Moses | last post by:
Hi All, Is is possible to catch the error of an undefined element while creating an object for it. Consider we are not having an element with id indicator but we are trying to make the object...
11
by: Matthew Wells | last post by:
Hello. I have figured out how to create an instance of an object only knowing the type by string. string sName = "MyClassName"; Type t = Type.GetType(sName); Object objNew =...
9
by: =?Utf-8?B?YmJn?= | last post by:
Hi all, I read somewhere "using kernel stuff in thread is not good.." if ManualResetEvent object is created in thread but not actually used, will it affect performance? Bob
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...
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
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,...

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.