|
-
Sep 17th, 2009, 07:49 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Pass variable to DLL
VS 2008, .NET 2, Win XP
I need help with passing a String variable from App to DLL?
Why: I have App that on UnhandledException needs to call ErrorReport dll, send to that dll some strings like: App name, stack, error... Dll will send through internet this gathered data to me.
I can open Dll, close it, code it, but I can not figure it how to send data to it like VB App name, VB App version, VB App error.message ...
For example I can in my form make a global variable like Public TestGlobal As String and that I can call from anywhere in my app, but how to do it with dll?
Code: I have app and one part of dll created:
VB.Net Code:
'===VB app code: 'call dll from my form on raising of UnhandledException error Dim mySERform As New ErrorReport.frmMain '=> i think i must here set the data that i wanna pass to dll? 'ErrorReport.FrmMain.<NoMethodsHere> mySERform.ShowDialog() '===DLL 'ErrorReport' code: Public Class frmMain Private DataString As String Public Property DataString1() As String Get Return DataString End Get Set(ByVal value As String) DataString = value End Set End Property Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '=> here goes the string(s) from VB app transfered to this dll fields TextBox1.Text = DataString1 End Sub End Class
Last edited by Zeljko; Sep 17th, 2009 at 07:55 AM.
-
Sep 17th, 2009, 08:43 AM
#2
Re: Pass variable to DLL
is the error report dll under your control or is it a third party? If it's something you have control over, you can do it in several ways... 1) Is to add parameters to your constructor... then apss in what ever info you need. 2) Create properties... after you've created your instance of the class, set the properties, then call what ever method you need to do the further processing.
-tg
-
Sep 17th, 2009, 08:43 AM
#3
Re: Pass variable to DLL
Code:
Dim mySERform As New ErrorReport.frmMain
mySERForm.DataString1 = "HELLO WORLD"
mySERForm.ShowDialog()
-
Sep 17th, 2009, 09:58 AM
#4
Thread Starter
Hyperactive Member
Re: Pass variable to DLL
aaaaaaaaaaaaaaaaaaaaaa
That hapens when I look at it too much and wanna complicate things. Like you said - it's in front of me all the time 
VB.Net Code:
'old
Dim mySERform As New ErrorReport.frmMain
ErrorReport.FrmMain.<NoMethodsHere>
mySERform.ShowDialog()
'new
Dim mySERform As New ErrorReport.frmMain
mySERform.MethodNameHere
mySERform.ShowDialog()
Thanks all for replying and helping me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|