[RESOLVED] How can "true" be an invalid property ?-VBForums
Results 1 to 33 of 33

Thread: [RESOLVED] How can "true" be an invalid property ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Resolved [RESOLVED] How can "true" be an invalid property ?

    Good evening everybody,
    Two pieces of code
    Code:
    Private Sub InitSources(Flag As Boolean)
    ' ...
    End Sub
    Code:
    Private Sub KN_Change(Index As Integer)  ' KN is a textBox
    ' ...
    InitSources (True) ==> error 380	Invalid property value
    ' ...
    End Sub
    Most of the time the call to InitSources works fine, in some circumstances which I cannot reproduce it gives an error 380.
    To my opinion "True" is always a boolean, how can that property be invalid ?

  2. #2
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    672

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by Herve_be View Post
    Good evening everybody,
    Two pieces of code
    Code:
    Private Sub InitSources(Flag As Boolean)
    ' ...
    End Sub
    Code:
    Private Sub KN_Change(Index As Integer)  ' KN is a textBox
    ' ...
    InitSources (True) ==> error 380	Invalid property value
    ' ...
    End Sub
    Most of the time the call to InitSources works fine, in some circumstances which I cannot reproduce it gives an error 380.
    To my opinion "True" is always a boolean, how can that property be invalid ?
    There must be something else involved.
    Can you provide an example project to recreate the error?
    MSDN online for VB6 - Language Reference - Controls Reference
    Download MSDN October 2001: disk 1, 2 and 3

  3. #3
    Fanatic Member
    Join Date
    Apr 2012
    Posts
    910

    Re: How can "true" be an invalid property ?

    The error is occurring inside the InitSources code. We need to see more of that sub.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,202

    Re: How can "true" be an invalid property ?

    Perhaps in some case you have a var named True that is not a boolean type.

    My suggestion, add a breakpoint before the call then step through the code and check the value of true

  5. #5
    Fanatic Member
    Join Date
    Apr 2012
    Posts
    910

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by DataMiser View Post
    Perhaps in some case you have a var named True that is not a boolean type.
    He'd be getting a type mismatch error if that were the case...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  6. #6
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    672

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by DataMiser View Post
    Perhaps in some case you have a var named True that is not a boolean type.

    My suggestion, add a breakpoint before the call then step through the code and check the value of true
    AFAIK that's not possible to do:

    Code:
    Private True as String
    MSDN online for VB6 - Language Reference - Controls Reference
    Download MSDN October 2001: disk 1, 2 and 3

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,345

    Re: How can "true" be an invalid property ?

    Indeed it is:
    Code:
    Private [True] as String
    Although, I suppose it could be argued that it's no longer named True, but [True]... but there it is.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    672

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by techgnome View Post
    Indeed it is:
    Code:
    Private [True] as String
    Although, I suppose it could be argued that it's no longer named True, but [True]... but there it is.

    -tg
    You can't.

    Code:
    Private [True] as String
    But you gave an idea for other thing, thanks:

    Code:
    Public Enum BooleanEx
        [False] = 0
        [True] = -1
        [Automatic] = 2
    End Enum
    Last edited by Eduardo-; Nov 30th, 2017 at 05:25 PM.
    MSDN online for VB6 - Language Reference - Controls Reference
    Download MSDN October 2001: disk 1, 2 and 3

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by DataMiser View Post
    My suggestion, add a breakpoint before the call then step through the code and check the value of true
    I cannot reproduce the case, if I do so it works fine.

    Quote Originally Posted by ColinE66 View Post
    The error is occurring inside the InitSources code. We need to see more of that sub.
    Each sub has its own trapping

    Code:
    Private Sub KN_Change(Index As Integer)
    67580   On Error GoTo KN_Change_Error
    
    67590    If Val(KN(Index).Text) = 0 Then KN(Index).Text = "1"
    67600    KN(Index).Text = Str$(Int(Val(KN(Index))))
    67610    n(Index) = Val(KN(Index).Text)
    67620    KW(Index) = Str$(Val(KDs(Index).Text) * (n(Index) - 1))
    67630    InitSources (True)
    
    67640   On Error GoTo 0
    67650   Exit Sub
    
    KN_Change_Error:
    
    67660    ErrHdl ("KN_Change dans Angles")
    End Sub
    Code:
    Private Sub InitSources(Flag As Boolean)
    3620   On Error GoTo InitSources_Error
    
    3630 X0 = Graph(0).ScaleWidth / 2      'Position de l'axe des X sur le graphique
    3640 Y0 = Graph(0).ScaleHeight / 2     'Position de l'axe des Y sur le graphique
    3650 d1 = 10 * Val(KDs(1))
    3660 d2 = 10 * Val(KDs(2))
    3670 If Flag = True Then ReDim Sources(n(1) * n(2))
    3680 Activesources = 0
    3690     For j = 1 To n(2)
    3700         For i = 1 To n(1)
    3710             srcnr = (j - 1) * n(1) + i
    3720             Sources(srcnr).X = X0 - d1 * (n(1) - 1) / 2 + (i - 1) * d1    'x de la source
    3730             Sources(srcnr).Y = Y0 - d2 * (n(2) - 1) / 2 + (j - 1) * d2    'y de la source
    3740             If Sources(srcnr).Angle = 0 Then Sources(srcnr).Angle = Val(KA(0))  'La première fois, l'angle est à zéro !
    3750             If Sources(srcnr).Color <> 0 Then Activesources = Activesources + Val(KR(1)) * Val(KR(2))
    3760         Next i
    3770     Next j
    
    3780    On Error GoTo 0
    3790    Exit Sub
    
    InitSources_Error:
    
    3800     ErrHdl ("InitSources dans Angles")
    End Sub
    The error handling routine build 2 files, one with the error code, the other with a screen capture, and saves them on the user's disk
    Code:
    Public Sub ErrHdl(ByVal ProcMod As String)
    52010       MsgTxt = "Erreur " & Err.Number & " (" & Err.Description & ")" & Chr$(10) & "ligne " & Erl & " procédure " & ProcMod
    52020     MsgBox ("Erreur fatale !" & Chr$(10) & MsgTxt & Chr$(10) & Chr$(10) & _
              "Le rapport d'erreur et une copie de la fenêtre du logiciel vont être sauvés."), vbCritical
    
          Dim TimeStamp As String
          Dim ParFileName As String
    52030    TimeStamp = Format(Now, "yymmddhhmmss")
    52040    ParFileName = App.Path & "\" & TimeStamp & ".err"
    52050    Open ParFileName For Output As #1
    52060    Print #1, Left$(TimeStamp, 6) & ":" & Right$(TimeStamp, 6) & ":" & Err.Number & ":" & Err.Description & ":" & Erl & ":" & ProcMod
    52070    Close #1
    
          'Use the keybd_event API to take a screen shot.
    52080    keybd_event vbKeySnapshot, 1&, 0&, 0&
              
    52090    DoEvents
              
          'Save the image from clipboard
    52100      ParFileName = App.Path & "\" & TimeStamp & ".bmp"
    52110      SavePicture Clipboard.GetData(vbCFBitmap), ParFileName
    
    52120       End
    End Sub
    I've got the screen shot but entering the sames data doesn't give an error.
    The other error report file contains 380:Invalid property value:63760:KN_Change dans Angles
    63760 is the line number of InitSources (True)
    if the error had occurred in InitSources the error report would contain ...........InitSources dans Angles

  10. #10
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,115

    Re: How can "true" be an invalid property ?

    you could try changing to
    Code:
    67630   Call InitSources (True)
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Well, I've found another similar error, I can reproduce it : the error is well in InitSource !

    Suppose I have an error in InitSource : it calls ErrHdl with "InitSources dans Angles" as parameter
    Suppose I have also an error in ErrHdl : it jumps to line 67660 in KH_Change which calls ErrHdl with "KN_Change dans Angles" as parameter which is saved in the error report file.

    How can I prevent error in ErrHdl ?
    On Error resume next ?

  12. #12
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,115

    Re: How can "true" be an invalid property ?

    probably you should assign the error code and description to your parameter for errhdl and clear the error before calling errhdl
    unless you clear any errors somewhere they can be passed forwards, i am fairly sure that resume or resume next will clear any error, but as you are not doing that, the errors remain current, in the following procedures

    it would also be possible that your error file and image could be overwritten as it is only recorded to the nearest second
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by westconn1 View Post
    probably you should assign the error code and description to your parameter for errhdl and clear the error before calling errhdl
    This would be a hard job to modify each call to ErrHdl : they are hundreds !
    Can I clear the error inside ErrHdl instead ? How ?
    Quote Originally Posted by westconn1 View Post
    unless you clear any errors somewhere they can be passed forwards, i am fairly sure that resume or resume next will clear any error, but as you are not doing that, the errors remain current, in the following procedures
    All right so why not "on error resume next" in ErrHdl ?

    Meanwhile I've found what goes wrong in ErrHdl
    Code:
    310   keybd_event vbKeySnapshot, 1&, 0&, 0&
    320   DoEvents
    330      ParFileName = App.Path & "\" & TimeStamp & ".bmp"
    340      SavePicture Clipboard.GetData(vbCFBitmap), ParFileName
    Sometimes I've an error 380 "Invalid property value" on line 340

  14. #14
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,115

    Re: How can "true" be an invalid property ?

    Can I clear the error inside ErrHdl instead ? How ?
    Err.Clear

    All right so why not "on error resume next" in ErrHdl ?
    or any other on error, should do the same, which would enable to error handle the errorhandler

    either would have to be after the first line, else you will not get correct message

    it would also be possible that your error file and image could be overwritten
    this would not be the case at all, i did not see you have End statement in your error handler, you should avoid using End, unless all your code is just in modules, you should unload all forms, dispose of objects etc and exit gracefully
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  15. #15
    Frenzied Member gibra's Avatar
    Join Date
    Oct 2009
    Location
    ITALY
    Posts
    1,448

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by Herve_be View Post
    Code:
    Private Sub KN_Change(Index As Integer)  ' KN is a textBox
    ' ...
    InitSources (True) ==> error 380    Invalid property value
    ' ...
    End Sub
    If you use parentheses in a Sub then you must use Call:

    Code:
    Call InitSources(True)
    else use simply:

    Code:
    InitSources True

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by gibra View Post
    If you use parentheses in a Sub then you must use Call:
    Code:
    Call InitSources(True)
    else use simply:
    Code:
    InitSources True
    Both are accepted and work the same, this is not the cause of the problem which is that there is an error in the error handler which is still running under the previous error.

    Meanwhile I've found what goes wrong in ErrHdl
    Code:
    310   keybd_event vbKeySnapshot, 1&, 0&, 0&
    320   DoEvents
    330      ParFileName = App.Path & "\" & TimeStamp & ".bmp"
    340      SavePicture Clipboard.GetData(vbCFBitmap), ParFileName
    Sometimes I've an error 380 "Invalid property value" on line 340 : what can be the reason of this error ?

  17. #17
    Frenzied Member gibra's Avatar
    Join Date
    Oct 2009
    Location
    ITALY
    Posts
    1,448

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by Herve_be View Post
    Sometimes I've an error 380 "Invalid property value" on line 340 : what can be the reason of this error ?
    Because the latest versions of Windows can interpret, and block, code that 'simulates' the keyboard and/or mouse, as also happens for SendKeys
    Also, access to Clipboard sometimes fails (however you should call Clipboard.Clear before capture)

    I use this class to capture desktop and save to bitmap file:

    Code:
    Option Explicit
    
    Rem ------------------------------------------------------------------------------------------
    Rem clsCaptureScreen.cls
    Rem ------------------------------------------------------------------------------------------
    Rem How to use:
    Rem Dim lngCapture As Long
    Rem Dim sFilePath As String
    Rem Dim CCaptureScreen As clsCaptureScreen
    Rem Set CCaptureScreen = New clsCaptureScreen
    Rem sFilePath = App.Path & "\Screenshot.bmp"
    Rem CCaptureScreen.OutputFileName = sFilePath
    Rem lngCapture = CCaptureScreen.CaptureScreen(myPictureBox)
    Rem If lngCapture <> 1 Then ERROR
    Rem ------------------------------------------------------------------------------------------
    
    
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC As Long) As Long
    
    Private mvarOutputFileName As String
    Public Property Get OutputFileName() As String
        OutputFileName = mvarOutputFileName
    End Property
    Public Property Let OutputFileName(ByVal vData As String)
        mvarOutputFileName = vData
    End Property
    
    Public Function CaptureScreen(ByRef pic As VB.PictureBox) As Long
        If mvarOutputFileName = vbNullString Then
            CaptureScreen = -1
            Exit Function
        End If
        pic.AutoRedraw = True
        pic.Width = Screen.Width
        pic.Height = Screen.Height
        BitBlt pic.hDC, 0, 0, Screen.Width \ Screen.TwipsPerPixelX, Screen.Height \ Screen.TwipsPerPixelY, GetDC(GetDesktopWindow), 0, 0, vbSrcCopy
        ReleaseDC GetDesktopWindow, GetDC(GetDesktopWindow)
        SavePicture pic.Image, mvarOutputFileName
        
        CaptureScreen = 1
    End Function

  18. #18
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    581

    Re: How can "true" be an invalid property ?

    > "Both are accepted and work the same"

    In this context, yes they do the same thing but, as soon as you start playing with Classes and trying to pass Object references around, then that insignificant little space before the opening brace becomes a whole new heap of Trouble.

    It makes VB evaluate the Default Property for the object and passes that to the function instead of the [intended] object reference.

    Code:
    Sub WhatIs( byval thing as variant )
       Debug.Print TypeName( thing )
    end Sub 
    
    Dim sc as SomeClass: Set sc = New SomeClass() 
    
    WhatIs sc 
    Call WhatIs(sc)
    WhatIs (sc)   ' A big fat error at best or, in the worst case, the function 
                  ' gets passed a property value instead of the complete object. 
    Regards, Phill W.

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by gibra View Post
    Quote Originally Posted by Herve_be View Post
    Sometimes I've an error 380 "Invalid property value" on line 340 : what can be the reason of this error ?
    Because the latest versions of Windows can interpret, and block, code that 'simulates' the keyboard and/or mouse, as also happens for SendKeys
    Also, access to Clipboard sometimes fails (however you should call Clipboard.Clear before capture)
    Thanks for the Capture screen function
    but I dont think Windows blocks keybd_event vbKeySnapshot, 1&, 0&, 0&
    because what happens is that, after the error 380 on SavePicture Clipboard.GetData(vbCFBitmap), ParFileName
    the error handler routine enters again, takes a snapshot and it works, i've got the .bmp file.

    If Windows were blocking the vbKeySnapshot it would block it each time not only the first time.

    I will try to Clipboard.Clear before capture.

  20. #20
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,345

    Re: How can "true" be an invalid property ?

    In short- your error handler needs some error handling. At the moment, the error in your error handling sub is bubbling back up to the calling sub. You could use OERN, but you probably would want something in the error handler to tell you something went wrong in there too.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by techgnome View Post
    You could use OERN
    What's this ?

  22. #22
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,345

    Re: How can "true" be an invalid property ?

    OERN = On Error Resume Next

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    If I get an error on
    keybd_event vbKeySnapshot, 1&, 0&, 0&
    or
    SavePicture Clipboard.GetData(vbCFBitmap), ParFileName
    I cannot do anything else to report the error (msg to user is useless) so the whole process may terminate, that's what I did.

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by westconn1 View Post
    you should avoid using End, unless all your code is just in modules, you should unload all forms, dispose of objects etc and exit gracefully
    The program has one main form which contains a lot of buttons each one calling a dedicated form i.e.



    If an error occurs in one sub-form a good idea is to close that sub-form instead of end-ing everything.
    The error is trapped (on error goto) by calling a common error handling routine located in a separate module.
    At the end of this error handling routine I replaced "end" by "Unload Me" but get this



    How can I find the form which has called the error handler and unload it ?

  25. #25

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Sorry, posted twice.

  26. #26
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,115

    Re: [RESOLVED] How can "true" be an invalid property ?

    I replaced "end" by "Unload Me" but get this
    Me can only refer to an object module, form or class, not a standard module

    the only simple solution that comes to mind is to unload all forms except mainform or whatever you call it

    Code:
    for each f in forms
         if not f.name = "mainform" then unload f
    next
    note form names are case sensitive
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  27. #27

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: [RESOLVED] How can "true" be an invalid property ?

    Quote Originally Posted by westconn1 View Post
    the only simple solution that comes to mind is to unload all forms except mainform
    Not possible to find the form from which the error handler routine has been called and unload that one only ?

  28. #28
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,115

    Re: [RESOLVED] How can "true" be an invalid property ?

    Not possible to find the form from which the error handler routine has been called
    only if you pass the form to the error handler, with the procedure name

    you could have a list of forms that you do not want to close if they are open

    or have some lookup table of procedure names to the containing form, which would only be possible if you do not use the same procedure names in different forms, though you would only have to lookup procedure names for currently opened forms
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  29. #29

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: [RESOLVED] How can "true" be an invalid property ?

    Hi,
    I've found a simple solution.
    The problem is that if an error is trapped in a form it calls an error handler module which cannot unload the form.
    The solution is, at the end of the error handler, to exit thus come back in the form which can unload itself.
    For instance
    Code:
    Private Sub KT_Change()
    On Error GoTo KT_Change_Error
    ...
    KT_Change_Error:
    
    ErrHdl ("KT_Change dans Salinite")
    Unload Me
    End Sub
    Code:
    Public Sub ErrHdl(ByVal ProcMod As String)
    ...
    Exit Sub
    End Sub
    Well thanks a lot and good bye.

  30. #30
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,115

    Re: [RESOLVED] How can "true" be an invalid property ?

    i thought you did not want to go back to edit every procedure that called the error handler, else that solution was too obvious
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  31. #31

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: [RESOLVED] How can "true" be an invalid property ?

    As far as the editing is limited to adding "Unload Me" behind each call is a good compromise.

  32. #32

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: [RESOLVED] How can "true" be an invalid property ?

    Better solution :
    Unload Screen.ActiveForm

  33. #33

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    113

    Re: How can "true" be an invalid property ?

    Quote Originally Posted by westconn1 View Post
    you have End statement in your error handler, you should avoid using End, unless all your code is just in modules, you should unload all forms, dispose of objects etc and exit gracefully
    Trying to avaid End I now unload the concerned form.
    The problem now is that when the error handler ends the unloaded form goes on and gives an error 364 Object was unloaded at the first try to acces one of it's form object !
    How can I end properly ?

    This subject being closed I opened a new one How to exit from VB6 error handler
    Last edited by Herve_be; Dec 28th, 2017 at 05:56 AM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.