vb .net null条件

1 .net null datetime

这是我的代码 -

            Dim provider As CultureInfo = CultureInfo.InvariantCulture
            Dim a1 As DateTime = Nothing
            insexp = DateTime.ParseExact(date1.SelectedValue, "MMMM yyyy", provider)
            If a1.Month = Today.Month AndAlso a1.Year = Today.Year Then
                a1 = Today.Date
            End If
Run Code Online (Sandbox Code Playgroud)

这仅在date1.selectedvalue不为null时才有效,但如果为null则会崩溃.如果条件不运行,我该怎么办?谢谢

tst*_*ter 5

If date1.SelectedValue IsNot Nothing Then
    ...
End If
Run Code Online (Sandbox Code Playgroud)