的代码:为什么0,而不是在VB System.Data.DataTable没有
Private m_log_dataTable As System.Data.DataTable = Nothing
Private m_freq As String = Nothing
Private m_r As Single = Nothing
Private m_l As Single = Nothing
Private m_c As Single = Nothing
Private m_rp As Single = Nothing
Private m_rs As Single = Nothing
Private m_z As Single = Nothing
Private m_esr As Single = Nothing
Private m_dcr As Single = Nothing
Private m_q As Single = Nothing
Private m_d As Single = Nothing
...
Private Sub LOG()
Try
m_freq = Nothing
m_r = Nothing
m_l = Nothing
m_c = Nothing
m_rp = Nothing
m_rs = Nothing
m_z = Nothing
m_esr = Nothing
m_dcr = Nothing
m_q = Nothing
m_d = Nothing
m_value = Nothing
m_unit = Nothing
m_log_dataTable.Rows.Add(DateTime.Now, getDUT(), getMode(), m_freq, m_r, m_l, m_c, m_r, m_rs, m_z, m_esr, m_dcr, m_q, m_d)'Line1
m_log_dataTable.Rows.Add(DateTime.Now, getDUT(), getMode(), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)'Line2
Catch ex As Exception
MsgBox("Exception when logging:" + ex.Message)
End Try
End Sub
为什么LINE-1(在上面代码)写0到数据表而不是Nothing? 我该怎么办?
谢谢
这是编译吗? 'Private m_r As Single = Nothing'是将Nothing分配给单个变量(不是单个变量?) –
@The_Black_Smurf是 – BAE
@The_Black_Smurf - 这是VB.NET允许的。它和C#默认的一样(System.Single)' –