I'm a little rusty on my VB.NET especially when converting to SQL. I thought I had a simple task of hiding 2 buttons unless a checkbox is checked. The checkbox is bound to a SQL Server column with a bit data type.
My code is as follows:
Private Sub CaseVehicleCollisionCheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CaseVehicleCollisionCheckBox1.CheckedChanged
Dim collision As System.Data.SqlTypes.SqlBinary
collision = CaseVehicleCollisionCheckBox1
If collision = True Then
btnVehicle1.Visible = True
btnVehicle2.Visible = True
ElseIf collision = False Then
btnVehicle1.Visible = False
btnVehicle2.Visible = False
End If
End Sub
I keep getting the error
Value of type 'System.Windows.Forms.CheckBox' cannot be converted to 'System.Data.SqlTypes.SqlBinary'
when trying to assign the checkbox to the variable.
I get the same error when trying to use System.Data.SqlTypes.SqlBoolean
Booleanrather thanSqlBinary, also note that there's no need for theIfstatement. Just saybtnVehicle1.Visible = collisionandbtnVehicle2.Visible = collision.