CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2003
    Location
    Holland
    Posts
    146

    run-time error 438 Please help!!

    Hello,
    When i call Exit from my menu, i get the message:
    'Run-time error 438.
    Object doesn'tsupport this property or method.'

    This is the closing sub.

    Private Sub mnuExit_Click()
    Close

    Temp$ = App.Path & "\data\huidige.wg"

    If FileExist(Temp$) Then
    Kill Temp$
    End If

    Unload frmMenu
    End

    End Sub

    I am trying for many, many hours to solve the problem, but no succes.
    Who knows the answer? I am getting desparade.

    Many, many thanks in advance.
    Herman Tabbert
    Last edited by HermanTabbert; January 21st, 2004 at 09:54 AM.

  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452
    I would suspect that it is your "Close" statement. What are you closing? Set a break point on the close statment and step through 1 line at a time. That will help you determine where the problem is.

    Good luck.

  3. #3
    Join Date
    Feb 2003
    Location
    Holland
    Posts
    146
    Thans for your quick answer.
    I was not very clear.
    The message is only when i run the programm from .exe.
    When i run it from VB i do not get she message.
    I have compiled it without the close statement, but no difference.
    Any suggestion?

  4. #4
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    Make sure that the Visual Basic for Applications reference is selected.
    The 'Close' statement should be fine (closes all open files).

    If you still get the error without the 'Close' statement, and during the execution of the exe, then you can put msgboxes in your application to figure out where it blows up.

    It could be that you need to reinstall components such as MDAC if you use them.
    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.

  5. #5
    Join Date
    Feb 2003
    Location
    Holland
    Posts
    146
    Hi Laurent,
    Visual Basic for Applications reference was selected.
    My opinion was that the problem was the 'Private Sub mnuExit_Click()'.
    When i from other exe's do not go back to the main menu,
    but 'end' the program, i always get the same message 'error 438'.
    So it must be in all the seperate programs. From this programms
    i make exe's an call then from the main menu.
    Now i am realy confused.
    Do you have any suggestion what this can be.
    As a beginner, i have no idea to go on.
    Hope some one can help me.
    Thanks,
    Herman

  6. #6
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452
    Depending on your application (and the controls place on the forms), using the END statement is not a good idea. Here is a quick overview of what I think is going on.

    When you are in a normal application and you click the "X" to close the application, VB goes through a set of routines to unload all the forms, controls, and references from memory.

    When you use the "END" statement, none of this happens. Basically, your program just stops. Controls can be left in memory but without their calling program. So when you have a control on your form, and you END your program, if these controls are not unloaded, they can then try to fire events/do procedures that are no longer available.

    The same thing can happen in the IDE when you hit the "Stop" button. This is notorious for crashing the IDE when you subclass a form and then you hit the stop button. VB just stops all execution and take the program out of memory. Then when windows tries to send your form a message, the memory is no longer available and the IDE just crashes.

    Try working on another way to end your program without using the END statement.

    Unload all your forms, and let the program exit normally.

    Hope this helps.
    Roger

  7. #7
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    I concur with sotoasty. Using End is a brutal way to exit an application.
    It should be the very last command after unloading forms and memory properly.

    Maybe use 'Unload Me' instead of 'End'

    I would still put message boxes in your code that will let you know where they are executed from. Compile your app, run the exe and follow your message boxes. This will let you isolate the function/module that causes the error.

    Have you tried your application on a different system?

    438 is an automation error. It could be the computer you are running the exe on, if different from your development system. I fixed this in one of my application by installing the lastest MDAC on a particular system because the applicaiton was accessing a database.
    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.

  8. #8
    Join Date
    Feb 2003
    Location
    Holland
    Posts
    146
    Hi guys,

    I will stay in a very dark room for a long time an shame me a lot!!!

    The problem was in this sub.

    '-----
    If FileExist(Temp1) Then
    'Adm selecteren
    Shell (App.Path & "\hata0010.exe"), vbMaximizedFocus
    Unload frmHatasal
    Set frmHatasal = Nothing

    Else

    ' werkgever aanmaken
    Shell (App.Path & "\hata0020.exe"), vbMaximizedFocus
    Unload frmHatasal
    Set frmHatasal = Nothing


    End If





    End If

    Print "HERE = 4" '????????????????????????????????????!!!!!
    End Sub
    '---
    On my screen i did not see the print statement.
    Stupid me. Sorry, sorry etc.
    Many thanks for your help.
    Herman


  9. #9
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450

    Glad you could resolve it.

    Don't worry, we'll let you out from time to time!!!
    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.

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