V Visual Systems AB \(Martin Arvidsson\) Oct 26, 2004 #1 Hi! How do I convert a CheckBox.Checked to an int? Regards Martin Arvidsson
M Morten Wennevik Oct 26, 2004 #2 Hi Martin, To get an int value out of you can do something like int i = CheckBox.Checked ? 1 : 0; A boolean value can't be translated to any other value, so you will need to test it, if true use 1, otherwise use 0.
Hi Martin, To get an int value out of you can do something like int i = CheckBox.Checked ? 1 : 0; A boolean value can't be translated to any other value, so you will need to test it, if true use 1, otherwise use 0.
S Scott M. Oct 26, 2004 #4 No, you shouldn't have to test it. You should be able to cast it into an integer and get back 0 or 1 directly.
No, you shouldn't have to test it. You should be able to cast it into an integer and get back 0 or 1 directly.
M Morten Wennevik Oct 27, 2004 #5 No, you shouldn't have to test it. You should be able to cast it into an integer and get back 0 or 1 directly. Click to expand... To add to this, there is no CType in C#, but you get the same effect using Convert.ToInt32(bool)
No, you shouldn't have to test it. You should be able to cast it into an integer and get back 0 or 1 directly. Click to expand... To add to this, there is no CType in C#, but you get the same effect using Convert.ToInt32(bool)