vb.net - why 0, not Nothing in VB System.Data.DataTable -
the codes:
private m_log_datatable system.data.datatable = nothing private m_freq string = nothing private m_r single = nothing private m_l single = nothing private m_c single = nothing private m_rp single = nothing private m_rs single = nothing private m_z single = nothing private m_esr single = nothing private m_dcr single = nothing private m_q single = nothing private m_d 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 exception msgbox("exception when logging:" + ex.message) end try end sub
why line1 (in above codes) write 0 datatable instead of nothing? should do?
thanks
you need use nullable type. change of single
types single?
, try again.
private m_r single? = nothing private m_l single? = nothing // etc
as gabor commented, you'll need access value
property or 1 of other methods available nullable(of t)
.
m_r.value ' access underlying value m_r.getvalueordefault() ' underlying value or, if none, default underlying type m_r.getvalueordefault(3) ' underlying value or, if none, default value decide
Comments
Post a Comment