T
tshad
I am trying to do a trinary statement to set a checkbox.
I need to check to see if a value in the DataView (which is a boolean) is
not null and true. If so set the checkbox, otherwise set to false or just
leave as is (which would be unchecked).
I tried:
(drv["Reviewed"] != DBNull.Value && (bool)drv["Reviewed"]) ?
chkReviewed.Checked = true: chkReviewed.Checked = false;
But get an error:
Error 27 Only assignment, call, increment, decrement, and new object
expressions can be used as a statement
How do I phrase this to get it to work?
Thanks,
Tom
I need to check to see if a value in the DataView (which is a boolean) is
not null and true. If so set the checkbox, otherwise set to false or just
leave as is (which would be unchecked).
I tried:
(drv["Reviewed"] != DBNull.Value && (bool)drv["Reviewed"]) ?
chkReviewed.Checked = true: chkReviewed.Checked = false;
But get an error:
Error 27 Only assignment, call, increment, decrement, and new object
expressions can be used as a statement
How do I phrase this to get it to work?
Thanks,
Tom