我想将DOB变量分配为null。

Dim DOB As Date = DTPSdob.Value
Dim datestring As String = DOB.ToString("d")
If chkSdob.Checked = False Then
      DOB = 'I want to assign here DOB variable as null'
Else
      DOB = datestring
End If

最佳答案

使用可为空的日期时间

    Dim DOB As Nullable(Of Date) = Date.Now
    Dim datestring As String = DOB.Value.ToString("d")
    DOB = Nothing

关于vb.net - 如何在VB.NET中将Date变量设置为null,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13739708/

10-13 06:07