这样改一下
Dim a As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim b As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
If a.text ="现金" Then
b.Value = Date.Today
End If
If a.text = "月结" Then
Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month
Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
b.Value = dt2
End If
If a.text = "月结30天" Then
Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month
Dim dt3 As New Date(y, m+1, Date.DaysInMonth(y, m+1)) '获取本月的最后一天
b.Value = dt3
End If