I’ve just started fooling around with the DataGridView in .NET 2.0. It’s awfully slick, but very convoluted in some ways. One can use a DataGridViewButtonColumn to display buttons in the DataGridView, which is nice.
What’s not nice about the DataGridViewButtonColumn are the silly steps you have to go through in order to get text displayed on the button. Instead of just setting the Text property, you also have to set the UseColumnTextForButtonValue boolean to true, like in the snippet below.
checkin = new DataGridViewButtonColumn();
checkin.HeaderText ="Check In";
checkin.Width = 45;
checkin.DisplayIndex = 0;
Now why in the world does one have to take this extra step? If I set a button’s Text property to some non-null value, wouldn’t that generally mean I want to, well, use that value? This is completely non-intuitive. Perhaps there’s a case for this behavior around somewhere, but I didn’t run across anything when Googling around.
I was fortunate enough to hear Scott Myers speak at the Software Development Expo back in ‘03 and he was all over this kind of foolishness. “Make it hard to use your components incorrectly” was something he repeatedly said.