CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2002
    Location
    England
    Posts
    163

    Angry Could somebody please explain why this doesn't work!

    I'm quite annoyed at the moment. This worked this morning, I swear, but now it doesn't. What is going on.

    In one project, compiled as a DLL I have this code:

    class cFormSFX:
    Code:
    Public Property Set TargetForm(frmNewValue As Object)
    
        If (TypeOf frmNewValue Is Form) Then
            MsgBox frmNewValue.Name
        End If
    End Property

    In a second project, compiled as an exe I have this code.

    form Form1
    Code:
    Private mobjTest        As FormSFX.cFormSFX
    
    Private Sub Form_Initialize()
        Set mobjTest = New cFormSFX
        
        Set mobjTest.TargetForm = me
    End Sub
    The typeof validation in the DLL fails, and I do not understand why. Can anyone help me?
    Finite

    "If a cat always lands on its feet, and a peice of bread always lands butter side down, if you strap a peice of bread butter side up to the back of a cat, will it hover?"

  2. #2
    Join Date
    Jul 2003
    Location
    I'm Here!
    Posts
    31
    How the heck were you able to display a messagebox from a DLL? Are there other components to the DLL you're not showing?

  3. #3
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    I also use a Msgbox in my dll, it works perfectly.

    What do you mean by it doesn't work anymore? Any error message? Was your DLL still registered when it failed?
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  4. #4
    Join Date
    Jul 2002
    Location
    England
    Posts
    163
    In the dll. It does not recognise the value in frmNewValue as a VB.Form object when I try and validate it in the Typeof statement. I have no idea why. Any ideas.
    Finite

    "If a cat always lands on its feet, and a peice of bread always lands butter side down, if you strap a peice of bread butter side up to the back of a cat, will it hover?"

  5. #5
    Join Date
    Jul 2002
    Location
    England
    Posts
    163
    Never mind guys. It seems that I can't run 2 IDE's at once (don't see why not, it works fine apart from that stupid little error).
    If I compiled the DLL it works perfectly, I just can't tweak things and test them as fast as I could with 2 IDE's. Alas, such is life. Thanks for the suggestions anyhow.
    Finite

    "If a cat always lands on its feet, and a peice of bread always lands butter side down, if you strap a peice of bread butter side up to the back of a cat, will it hover?"

  6. #6
    Join Date
    May 2003
    Location
    Australia
    Posts
    155
    Hi,

    Just on a side note ...

    Using the TypeName() VB function gives you a text name of what the variable type is, which might be useful when the TypeOf operator doesnt seem to be working.

    Just knowing what the actual variable type is in this kind of situation can often help you solve the problem and bypass all that confusion and frustration.

    Cheers,
    Tinbum747
    Zen-Programming:

    If a compiler beeps in the IDE forest, and nobody hears it, was there really a bug?

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