latika singh

latika singh

  • NA
  • 31
  • 33.7k

Setting property values

Nov 2 2011 6:03 PM
Dear All,

I have a property that returns a private variable. Inside my Set loop I have created the following if condition:

Try
                    If value >= 0 And value <= 1000 Then
                        m_var = value
                    End If
                Catch ex As Exception
                    MsgBox("Value out of range [0 -- 1000]")
End Try

Now it will catch an exception if the value is out of range 0 -- 1000. But how do I setup the value in a way that if the user enters 30 it should not accept this value; instead these values should be a multiple of 20. So as soon as I enter 30 it should change it to 20. If I enter 50 then it should revert it to 40. I am not sure if we would have to use a step command and loop through values between 0 -- 1000 everytime code enters into this property.

Please suggest.

Answers (1)