I'm sure this has been answered before, but my search was fruitless.

I have a class, it has a property, which is a double. How should I be validating that when the property is set, the value is a double? I don't seem to be able to catch the error prior to it happening.

The scenario that causes this problem is allowing the user to put a value in a Property Grid (PropertyGridEx to be exact). Because the value is directly connected to the class property I seem to be unable to intercept rubbish data.

I have tried a Try/Catch in the Property Set method, but this seems to be too late in the process.

Code:
Public Class Rail

    Private dblOffset As Double

    Public Property offset() As Double
        Get
            Return dblOffset
        End Get
        Set(ByVal value As Double)
            dblOffset = value
        End Set
    End Property

End Class
Thanks in advance!