CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2001
    Location
    Venezuela
    Posts
    23

    Help with VB6, i'm building a Dll but the form is not recognixing the public vars

    Hello, i am building a Dll, but when compiling it, somehow the internal form that haves some controls, it is not recognizing any of the global variables i created in the public class.

    The original project was an EXE, but i had to change it into a DLL, but now the form is not recognizing the variables, any help??

    For example, here is the VAR declaration:

    Option Explicit
    Public host_ As String
    Public port_ As String

    and inside the form, it is not recognizing it:


    Private Sub Extension_1_TEvent(EventInfo As DesktopToolkitX.TEventInfo)
    Dim list_count As Integer
    list_count = EventInfo.UserData.GetCount
    Dim pair As CTKVPair
    Dim Key As String
    Dim value As String
    Dim i As Integer
    Dim guardar As Boolean

    guardar = False

    i = 0

    Dim ani, dnis, cedula, pin, origen, destino, nombre, ivr_tipocliente, ivr_segmento, blanco, skill, RTargetRuleSelected, RTargetTypeSelected, RTargetObjectSelected, RTargetAgentSelected, RTargetPlaceSelected, Rtenant, RStrategyName, X, Y As String
    For i = 0 To list_count - 1

    Set pair = EventInfo.UserData.Get(i)
    Key = pair.Key

    If (pair.Type = CKVHost) Then
    host_ = pair.StringValue
    End If

    .....




  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Help with VB6, i'm building a Dll but the form is not recognixing the public vars

    Not really sure what you are saying. I do see an issue with your dim statements. It is a very bad idea to dim all your vars all on one line, makes it very hard to read and in this case is not dimming them properly.
    In this case
    Code:
    Dim ani, dnis, cedula, pin, origen, destino, nombre, ivr_tipocliente, ivr_segmento, blanco, skill, RTargetRuleSelected, RTargetTypeSelected, RTargetObjectSelected, RTargetAgentSelected, RTargetPlaceSelected, Rtenant, RStrategyName, X, Y As String
    Y is dimmed as a String, all the others are Dimmed as Variants because you did not specify what they should be dimmed as.

    Code:
    Dim ani As String, dnis As String, cedula As String ' an so on
    As for your Dll and form I assume you are talking about a from that is not in the dll and is trying to use the dll. I do not know if the code you have shown is from the DLL or the Form or both and you gave no info on how you built the dll nor how you added it to your project.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jan 2001
    Location
    Venezuela
    Posts
    23

    Re: Help with VB6, i'm building a Dll but the form is not recognixing the public vars

    Thanks for the tip.

    The form is inside the DLL, i changed all the global variables declarations and placed them under the Main Class, and it works now.

    Thanks.

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Help with VB6, i'm building a Dll but the form is not recognixing the public vars

    You can also place global variables in a .bas module. Then they will be seen by all other modules without having to declare and instantiate anything. Same for subs and functions.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

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

Featured