Results 1 to 4 of 4

Thread: [RESOLVED] Pass variable to DLL

  1. #1

    Thread Starter
    Hyperactive Member Zeljko's Avatar
    Join Date
    Oct 2006
    Location
    Internet
    Posts
    441

    Resolved [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:
    1. '===VB app code:
    2.    'call dll from my form on raising of UnhandledException error
    3.    Dim mySERform As New ErrorReport.frmMain
    4.    '=> i think i must here set the data that i wanna pass to dll?
    5.    'ErrorReport.FrmMain.<NoMethodsHere>
    6.    mySERform.ShowDialog()
    7.  
    8.  
    9. '===DLL 'ErrorReport' code:
    10. Public Class frmMain
    11.    Private DataString As String
    12.  
    13.    Public Property DataString1() As String
    14.         Get
    15.             Return DataString
    16.         End Get
    17.         Set(ByVal value As String)
    18.             DataString = value
    19.         End Set
    20.    End Property
    21.  
    22.    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    23.       '=> here goes the string(s) from VB app transfered to this dll fields
    24.       TextBox1.Text = DataString1
    25.    End Sub
    26. End Class
    Last edited by Zeljko; Sep 17th, 2009 at 07:55 AM.
    1. If this post helped you, please Rate it = That's You, saying Thanks, to Me ...Left side of this post: [Rate this post]
    2. Mark this Thread Resolved if your question has been answered That's You, saying Thanks, to Group ...Menu on top of your original Post: [Thread Tools]>[Mark Thread Resolved]
    3.
    Check my site: www.er-ef.netCheck my snippets: Get installed .NET versionsRegex extractingJoin hierarchically nested Datatables in one flattened Datatable


  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Pass variable to DLL

    Code:
    Dim mySERform As New ErrorReport.frmMain 
    mySERForm.DataString1 = "HELLO WORLD"
    mySERForm.ShowDialog()

  4. #4

    Thread Starter
    Hyperactive Member Zeljko's Avatar
    Join Date
    Oct 2006
    Location
    Internet
    Posts
    441

    Resolved 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:
    1. 'old
    2.    Dim mySERform As New ErrorReport.frmMain
    3.    ErrorReport.FrmMain.<NoMethodsHere>
    4.    mySERform.ShowDialog()
    5. 'new
    6.    Dim mySERform As New ErrorReport.frmMain
    7.    mySERform.MethodNameHere
    8.    mySERform.ShowDialog()
    Thanks all for replying and helping me.
    1. If this post helped you, please Rate it = That's You, saying Thanks, to Me ...Left side of this post: [Rate this post]
    2. Mark this Thread Resolved if your question has been answered That's You, saying Thanks, to Group ...Menu on top of your original Post: [Thread Tools]>[Mark Thread Resolved]
    3.
    Check my site: www.er-ef.netCheck my snippets: Get installed .NET versionsRegex extractingJoin hierarchically nested Datatables in one flattened Datatable


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width