0
我以前发布过这个问题,但没有得到正确的答案 - 这里是我的代码再次if条件。.net dropdownlist if condition
Dim provider As CultureInfo = CultureInfo.InvariantCulture
Dim a1 As DateTime = Nothing
If date1.selectedvalue isnot nothing Then
insexp = DateTime.ParseExact(date1.SelectedValue, "MMMM yyyy", provider)
End If
If a1.Month = Today.Month AndAlso a1.Year = Today.Year Then
a1 = Today.Date
End If
date1是aspx页面中的下拉列表,如果您没有选择它,则没有值。它不是强制性的下拉列表。当我在调试器模式下运行它时,我得到date1 = ""
的值。这就进入了如果条件和崩溃。请指点如何使这项IF条件工作