If you assign a value but it is invalid how to send back a flag

In the below code, I would only like to assign values that are greater than 0.

How do I send back a flag to say that is was not assigned to the property.
If I did this would it be a standard practice.

Public Property Let ExchangeRate(value As Double)
    If mExchangeRate <> value Then
        mExchangeRate = value
        mIsDirty = True
    End If
End Property

swansonplaceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark_FreeSoftwareCommented:

You could use a messagebox to notify the user
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Are you talking about notifying the end user or the programmer?

If the programmer, then you can use a function instead of a property.  The function would return true/false to indicate if the value was updated or not.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ExtremeFitnessCommented:
Not sure you can do it with a property, how about a function to do the same??

Public function ExchangeRate(value As Double) as Boolean
    If mExchangeRate <> value Then
        mExchangeRate = value
        mIsDirty = True
        ExchangeRate = True
    End If
End Property

ExchangeRate(100) = True if the number value was changed
False if not...
0
Kaleb2000acCommented:
Hi
As this is a property there are 3 solusions
1. You can raise an error when the value is negative using RaiseError function but it will stop the program when that happends
2. You can validate and if it is invalid force it to a predefined value.

Luck
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.