Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

make a DLL execute a FUNCTION in a FORM with VB.NET

Posted on 2003-10-22
4
Medium Priority
?
262 Views
Last Modified: 2010-04-17
This should be an EASY one guys!

I have a form called form1 and a function called doStuff. The doStuff function takes 2 integers in and does things (like modify textboxes on the form and modify global variables etc).  In form1, I can call it simply like this: doStuff(5,8) and it works great!

I have a DLL.  I launch this dll 500 times and it goes out and "does its thing" and reports back in a minute or so when it's done.  I want it to send its gathered information to the doStuff function in Form1 before it unloads itself.

In the DLL, I'm using the code:
        Dim asdf As Form1
        asdf.doit(x, y)   '(x and y are integers)

and it's not working!  It seems to be running the function as it it were IN the DLL (there are no textboxes in the DLL!)

How do I make the DLL call a function on Form1 and have it run *ON FORM1*?  Thanks in advance!
0
Comment
Question by:KnightHacker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Accepted Solution

by:
Sandeepk1999 earned 500 total points
ID: 9617843
You can accomplish using raising events from your DLL object. Here is the sample code:

'This code goes into your Form
    Private WithEvents obj As New ObjDLL.clsTest()

    Private Sub obj_TestEvent(ByVal i As Short, ByVal j As Short) Handles obj.TestEvent
        TextBox1.Text = i
        TextBox2.Text = j
    End Sub


'This code goes into your DLL object
Public Class clsTest
    Public Event TestEvent(ByVal i As Int16, ByVal j As Int16)

    Public Sub TestMethod()
        Dim iTest1 As Int16 = 10
        Dim iTest2 As Int16 = 20
        RaiseEvent TestEvent(iTest1, iTest2)
    End Sub
End Class
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question