0
为什么下面的代码在VB.net 2008中有错误?VB.net:通过条件设置“NULL”属性?
Dim Object1 As New Class1
Object1.SetId = If(rbSet.Checked = True, Convert.ToInt32(txtSetId.Text.Trim()), DBNull.Value)
我想要的是通过条件来设置对象的属性。
为什么下面的代码在VB.net 2008中有错误?VB.net:通过条件设置“NULL”属性?
Dim Object1 As New Class1
Object1.SetId = If(rbSet.Checked = True, Convert.ToInt32(txtSetId.Text.Trim()), DBNull.Value)
我想要的是通过条件来设置对象的属性。
使用没有
Object1.SetId = If(rbSet.Checked = True, Convert.ToInt32(txtSetId.Text.Trim()), Nothing)
什么数据类型是`SetId`财产,什么是错误讯息? – 2011-01-20 14:06:22