Why below code has error in VB.net 2008?
Dim Object1 As New Class1
Object1.SetId = If(rbSet.Checked = True, Convert.ToInt32(txtSetId.Text.Trim()), DBNull.Value)
What I'm trying is to set a property of an object by a condition.
Why below code has error in VB.net 2008?
Dim Object1 As New Class1
Object1.SetId = If(rbSet.Checked = True, Convert.ToInt32(txtSetId.Text.Trim()), DBNull.Value)
What I'm trying is to set a property of an object by a condition.
Use Nothing
Object1.SetId = If(rbSet.Checked = True, Convert.ToInt32(txtSetId.Text.Trim()), Nothing)