Jump to content

Recommended Posts

Posted (edited)

I found na intresting example:

https://msdn.microsoft.com/en-us/library/ms677489(v=vs.85).aspx

 

there is sucha a example:

 

' Error handler
FormLoadError:
    Dim strErr As String
    Select Case Err
        Case adErrObjectOpen
            strErr = "Error #" & Err.Number & ": " & Err.Description & vbCrLf
            strErr = strErr & "Error reported by: " & Err.Source & vbCrLf
            strErr = strErr & "Help File: " & Err.HelpFile & vbCrLf
            strErr = strErr & "Topic ID: " & Err.HelpContext
            MsgBox strErr
            Debug.Print strErr
            Err.Clear
            Resume Next
        ' If some other error occurs that
        ' has nothing to do with ADO, show
        ' the number and description and exit.
        Case Else
            strErr = "Error #" & Err.Number & ": " & Err.Description & vbCrLf
            MsgBox strErr
            Debug.Print strErr
            Unload Me
    End Select
End Sub
' EndErrorHandlingVB01

 

Question why there is used Case Else ?
I see the comment but is it needed to use such snippet in AutoIt ?

EDIT:
It should be that the snippet is much more VB related, but I just want to know.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 3 weeks later...
Posted (edited)

Bump,     maybe someone knows the answer ?


EDIT: On the other hand, maybe my question is stupid? If so, please enlighten me.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681549(v=vs.85).aspx

adErrObjectOpen "Operation is not allowed when the object is open. An object that is open cannot be opened. Fields cannot be appended to an open Recordset."

As I understand VB has a different syntax.
I do not understand whether I well understand the code - I mean these two lines.

Select Case Err
        Case adErrObjectOpen

Is the "case" of the second line refers to the first line ? If YES >> How this enum adErrObjectOpen refers to Err object ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/20/2015 at 7:15 PM, mLipok said:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681549(v=vs.85).aspx

adErrObjectOpen "Operation is not allowed when the object is open. An object that is open cannot be opened. Fields cannot be appended to an open Recordset."

As I understand VB has a different syntax.
I do not understand whether I well understand the code - I mean these two lines.

Select Case Err
        Case adErrObjectOpen

Is the "case" of the second line refers to the first line ? If YES >> How this enum adErrObjectOpen refers to Err object ?

adErrObjectOpen is get by evaluating Err object on error (I would guess Err.Number is it's default property). In AutoIt you would check $oErr.number obviously.

♡♡♡

.

eMyvnE

Posted
  On 9/20/2015 at 9:13 PM, trancexx said:

I would guess Err.Number is it's default property

That I had suspicions.

The rest of your speech was already known to me before.
The whole cemented me in my thoughts.

Many thanks for the conversation.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...