What does “Method '~' of object '~' failed” at runtime mean?

后端 未结 8 1795
耶瑟儿~
耶瑟儿~ 2020-12-01 13:41

I\'m trying to run a legacy VB6 application on my desktop (it doesn\'t have a user interface, being a command-line app), and when I do, I get a message box saying

         


        
8条回答
  •  心在旅途
    2020-12-01 14:39

    I have VB6 SP6 and I can reproduce this behavior. In a fresh project, put this code into a form. The project runs normally with F5. Right click the project and select Publish then Build Outputs. This generates the error message.

    Option Explicit
    
    Public Sub Init()
        Dim blnErrorHandling As Boolean
    
        If False Then
            blnErrorHandling = True
        Else
            blnErrorHandling = False
    End Sub
    

    Now comment out the last four lines:

    Option Explicit
    
    Public Sub Init()
        Dim blnErrorHandling As Boolean
    
    '    If False Then
    '        blnErrorHandling = True
    '    Else
    '        blnErrorHandling = False
    End Sub
    

    You no longer get the error and the outputs are built normally. I was quickly adding in some error handling to locate the source of a crash and If False Then is perfectly valid. The MDAC checker said all was ok and a reboot didn't solve the problem.

提交回复
热议问题