Solved

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

Posted on 2003-10-22
4
256 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 125 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

739 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