Given the following code:
Dim widthStr As String = Nothing
This works - width is assigned Nothing:
Further to Damien's answer, the clean way to do this is to not use Nothing, but New Double? instead:
Dim width As Double? = If(widthStr Is Nothing, New Double?, CDbl(widthStr))
And now that the type of the If expression is correct, this could be reduced to:
Dim width = If(widthStr Is Nothing, New Double?, CDbl(widthStr))