Looking for a little education...

Looking for a little education...

David_Prontnicki
Collaborator Collaborator
680 Views
2 Replies
Message 1 of 3

Looking for a little education...

David_Prontnicki
Collaborator
Collaborator

Hi All,

 

Could someone explain to me this prompt status: If acSSet.Status = 5100 Then?

 

I am used to have prompt statuses similar to this: If acSSet.Status <> PromptStatus.OK Then.

 

I have never seen this before, I am working on something and came across it online while searching for something. I was just curious about it's meaning and use.

 

Thank you,

Dave

0 Likes
Accepted solutions (1)
681 Views
2 Replies
Replies (2)
Message 2 of 3

ActivistInvestor
Mentor
Mentor
Accepted solution

You can read up on what 'Enum' types are and how they're used in the .NET framework. They are actually a more verbose and descriptive way of expressing an ordinal value (an integer). They also help the programmer avoid passing an incorrect numeric value that is not one of the values that's required.

 

For example, this is the definition of the PromptStatus enum type:

 

   public enum PromptStatus
   {
      Cancel = -5002,
      None = 5000,
      Error = -5001,
      Keyword = -5005,
      OK = 5100,
      Modeless = 5027,
      Other
   }

 

When you read code, you don't really want to have to look up what a given numeric argument represents, in cases where the argument must be one of a set of pre-determined values. For that reason, an integer can be used in lieu of an enum member, although doing so is unwise and almost universally accepted as a bad coding practice.

 

In your latest post, you use an integer in a call to Transaction.GetObject() rather than a member of the OpenMode enum, which makes it much more difficult to read and understand what the argument means.

 


@David_Prontnickiwrote:

Hi All,

 

Could someone explain to me this prompt status: If acSSet.Status = 5100 Then?

 

I am used to have prompt statuses similar to this: If acSSet.Status <> PromptStatus.OK Then.

 

I have never seen this before, I am working on something and came across it online while searching for something. I was just curious about it's meaning and use.

 

Thank you,

Dave


 

Message 3 of 3

David_Prontnicki
Collaborator
Collaborator

Thank you ActivistInvestor,

 

As always you are were very helpful. I read up on them and the pros and cons of using them. I really appreciate the help and push in the right direction. It means a lot.

 

Thank you,

Dave

0 Likes