The logic of this particular application is that the check box is bound to column ProjectStatus. Project status can be either Active (1) or InActive (0). Usually when user adds a new project it would be active (it would not make much sense to add an inactive project). This is why I set a new record to value 1.
And I agree that I need to learn how to override some existing methods of .NET framework or create my own in a sub-class (as you did). I have another 30 years before I can retire so I have time <g>.
>Yes, that is one bad thing about the .NET CheckBox ... it doesn't natively work with DBNull.Value. It's interesting that you have decided to set a default in a new row of 1 rather than 0. I would think that you'd want the CheckBox to default to un-checked rather than checked. But, hey, I don't know what your requirements are. Allowing NULLs in your database columns is not a bad thing, although I'm pretty sure that's one of those "religious" topics that'll get you differing opinions from everyone.
>
>You're going to find lots of functionality in the native .NET controls that you don't like. Sub-classing them before-hand and using the sub-classes is definitely the way to go with .NET. When I started back in 2002, putting this DataBind() method in all my sub-classes was *critical* to the way I was using DataBinding. I suggest that you don't overlook this functionality in your own sub-classes.
>
>~~Bonnie
>
>
>
>
>>For once instead of asking you a question I will share with you something I found. I know now why when I was binding the check box using the syntax
>>
>>
>>this.chkStatus.DataBindings.Add("Checked", bindingSource1, "VendorStatus");
>>
>>
>>things would not work when moving in the grid to the new row. Or when creating a new row in code in my AddNew button. I am sure you already know that but the reason is that my column VendorStatus allows NULLs and when a new row is added in the grid the value set to the check box is NULL. And method DataBindings.Add has a problem with NULLs. I suppose this is why you created your own method DataBind(). So my solution will be NOT to allow user to add a new row while browsing the grid (I have not checked it but hopefully this property/setting exist). Then in my Add New button when adding a new row to the table I will set the value of the Check Box Column to 1. I just tested it and it works. Or better, I will change my database design not to allow NULLs and see if this setting will work too. But the good news is that I don't have to create a bunch of methods BindData in my subclasses. You see every time I create some code - since I am still learning a lot - I am bound (no pun intended) to make a mistake.
>>
>>I am sure I will be back with more questions as on every step of my development I am hitting a wall (my head hurts <g>).
>>
>>Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham