Checkbox question

  • Thread starter Thread starter ascll
  • Start date Start date
A

ascll

Greetings,

How do I get the value of Checked and Uncheck status of my CheckBox?
For example, Checked = 1 and Uncheck =0

Kindly advise.

Thanks
ascll
 
Greetings,

How do I get the value of Checked and Uncheck status of my CheckBox?
For example, Checked = 1 and Uncheck =0

Kindly advise.

Thanks
ascll

Well the value of the ComboBox.Checked property is either true or false,which is neither 1 nor 0. However, you can map it to a number using Convert.ToInt32(true), which will return 1. Likewise you can Convert.ToBoolean(1234) which will be true for any number other than 0.

If you need this functionality due to database communication, don't convert the number at all. Use SqlParameter (or OleDBParameter) objects, they will convert between bool and SqlDBType.Bit automatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top