Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MDI Form Error on Close (VB6)

    I've been plagued with this intermittent problem that is now happening pretty consistently. I have a main form that has a search button on it. When the end user selects the search feature and the criteria returns multiple records I launch another form (vbModal) displaying the return in a ListView grid. I have a select button, a cancel button, and code in the double click event. In the double click and select button events it takes the index number of the record, loads it into a global variable to pass the value back to the calling form, then closes the form using the command Unload Me. Clicking on the Cancel button simply executes the Unload Me.

    The error I'm getting is "Invalid procedure call or argument" and it occurs when I attempt to select the record. It is a generic error not handled by any error handler in the form or calling form. This is unusual to me because I went through every line of code and made sure everything was trapped by an error handler (also verified that I'm releasing all my object variables while I was at it).

    Extremely frustrating that it works fine in my development environment but will error every time for every record when running on the server. This is in a citrix session but that shouldn't make a difference. The server was recently built and has all the updates on it with the latest MDAC. I had to use a series of message boxes to identify exactly where the point of failure was and keep compiling the code to the server. I found it was occuring in the Unload Me statement itself. I've tried Unload frmDupes (the name of the form), I've tried hiding the form...no matter what I try I still get this error and I can't even figure out where it is being spawned from.

    I am completely out of ideas and would appreciate any suggestions.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: MDI Form Error on Close (VB6)

    Try Me.Hide and then Unload the hidden form from the code in your other form?

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDI Form Error on Close (VB6)

    I get the same error. It does execute the next line of code (a message box telling me where it is at) but the error appears to kill the project before control is passed back to the calling form.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: MDI Form Error on Close (VB6)

    So you have, more or less:
    <UL>Me.Hide
    MsgBox "Me Hidden"
    End Sub[/list]*Boom* error message.

    It sounds as though perhaps the problem is in the form that is regaining control. What is the next thing that VB is supposed to do?

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDI Form Error on Close (VB6)

    Yes, well, close enough. I also have a message box following the form.show in the calling form that is triggered after that generic error is raised.

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDI Form Error on Close (VB6)

    Okay, did some painstaking troubleshooting I want to share with you that yielded some interesting results.

    The way this application works is that you have a main form that you are querying records bases on a criteria entered by the user. When there are multiple returns I show frmDupes in a modal state that contains a listview control showing all of the possible records. The user has a variety of ways to select which record they need. When a record is selected the value of the record is stored in a global string variable called gsMRN. The form is subsequently closed and the calling form, frmMain, then validates and processes the value of gsMRN. Works perfectly in my IDE envoriment. When compiled to the server it returns an unhandled error from somewhere...which I've already described.

    In the frmMain, if I were to do something like "msgbox gsMRN" - I would first get the unhandled error, then I get the message box with the appropriate value listed from the global var, then the application ends after clicking on the OK button of the message box.

    Have you seen anything like this? I've even tried doing this with different data types, including Variant.

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: MDI Form Error on Close (VB6)

    I've never seen anything like this. But we can discuss a multipage control featuring randomly accessible listboxes using ADO to read an XML file some time. <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

    I wonder whether there is something that VB is doing in the background, destroying some object or closing some connection, that it is doing after something else is closed or destroyed that is causing this problem. Think about how the server environment might respond differently than the development environment in terms of what's slower (data access always is a possible culprit). Perhaps there's something you can do in the submit handling code in your modal form, before hiding it, to take care of "something" that otherwise happens too slowly?

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDI Form Error on Close (VB6)

    I've continued troubleshooting since we talked last. I've found that wherever there is a msgbox command, it will raise that error, show the message box, then kill the application. I've ran several tests at numerous points in the code and happens 100% of the time. I think I can eliminate the Citrix seemless session as a factor because when I remote into the server and run it directly, I get the same thing.

Posting Permissions

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