I want to set binary values on and of at will. So I derived from the CheckBox class to change it's appearance. Instead of a checkmark I like to implement a 0 or 1 here.
This is the code of my class so far:

class BinarycheckBox : CheckBox
        public BinarycheckBox()

Nothing special, I expected to get a normal checkbox with the following:

public partial class Form1 : Form
        private BinarycheckBox BinCB;

        public Form1()

            //initialize new binary checkbox
            this.BinCB = new BinarycheckBox();
            this.BinCB.AutoSize = true;
            this.BinCB.Location = new System.Drawing.Point(70, 95);
            this.BinCB.Name = "bin";
            this.BinCB.Size = new System.Drawing.Size(80, 17);
            this.BinCB.TabIndex = 0;
            this.BinCB.Text = "bin";
            this.BinCB.UseVisualStyleBackColor = true;
            this.BinCB.Visible = true; //even this does not work

This compiles and runs perfectly, but no checkbox is showing. What am I overlooking here? Any help will be much appreciated.

8 Years
Discussion Span
Last Post by Antenka

Hello, ddanbe. All you have to do is add your BinCB to the list of Controls of your form:

Votes + Comments
I could have known this but thanks for reminding!

I knew it must have been something terribly stupid! Thanks for reminding me I am still human. In latin one would say : errare humanum est.
Keep on your good work.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.