Solved

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

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This is about my first experience with programming Arduino.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Starting up a Project

626 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