Lazycoder

2Aug/071

Should people adapt to computers?

There was a comment over at Jeff Atwoods latest post “Meet the inventor of the mouse wheel“:

“The solution to computer illiteracy is to learn, not to cut the capabilities of the system for everyone. That’s the triumph of ignorance.”

Is that really the point? Whatever the developer decides is what’s right? People should adapt to the computer, no matter how poorly designed, rather than adapting the computers to people?

To me, the point of pushing the boundaries with technology, is to make the technology easier to use. In face, that’s the underlying theme of my entire career. Using my knowledge and skill to make someone else’s job easier. Making my job easier.

12Sep/060

Adding values to the DataGridViewComboBoxCell at runtime

Welcome to hackville population me.

The DataGridViewComboBoxCell won't allow values to be entered in the cell if they are not in the Items collection. Since I can't modify the Items collection if the DataSource property is set, I add value of the cell that's causing the DataError to the DataSource for the combo box. Since it doesn't throw anything sensible like a ComboBoxValueNotInItems exception, and it doesn't raise something nice like a "DataBinding" event or an "ValueNotInItems" event, or even an "Validating" event, I have to trap the System.ArgumentException. This may come back to bite me later. For one thing, will I ALWAYS set the Datasource to a DataTable object? What if I use another object for the data source.

C#:
  1. private void dgStuff_DataError(object sender, DataGridViewDataErrorEventArgs e)
  2.         {
  3.  
  4.             if (e.Exception is System.ArgumentException)
  5.             {
  6.                 if (this.dgStuff.Rows[e.RowIndex].Cells[e.ColumnIndex] is DataGridViewComboBoxCell)
  7.                 {
  8.                     DataGridViewComboBoxCell _cell = this.dgStuffDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewComboBoxCell;
  9.                     DataTable _dt = _cell.DataSource as DataTable;
  10.                     DataRow _newRow = _dt.NewRow();
  11.                     _newRow["LkpCode"] = _cell.Value;
  12.                     _newRow["LkpDescription"] = _cell.Value;
  13.                     _dt.Rows.Add(_newRow);
  14.                     _dt.AcceptChanges();
  15.                 }
  16.             }
  17.         }

I found a post in the MSDN forums where they talk about accepting user input in the DataGridViewComboBoxCell which isn't in the cells Items collection.

7Nov/050

Visual Studio Express editions free for 1 year

Wow. Microsoft FINALLY gets it. Even if just a little bit.

For 1 year, starting Nov 7th, you can download and use any of the Visual Studio Express Editions for free.

I often said the only reason I'm experimenting with Cocoa development is that XCode comes with OS X for free. If I had to pay $400 for XCode, I wouldn't be using it. In fact, Xcode for free is part of the reason I finally took the plunge and bought an Apple machine. I get to tinker for free!

Now, Microsoft has the chance to prove that they really get it by providing all of the free express editions ON THE VISTA RELEASE DVD. C'mon Microsoft, plant the seeds for a whole new generation of developers for your platform.

Filed under: .NET, C#, General, VB.NET No Comments
15Aug/053

Running visual studio versions side by side

Has anyone had any luck running Visual Studio versions side by side? I'm going to try running VS 2003 and VS 2005 b2 on the same machine at home. It's not a production machine so I'm not too worried about it's stability.

Filed under: .NET, C#, General, VB.NET 3 Comments
5Jul/053

A quick tip when dealing with resources

A quick tip, this may already be well known around the community, when dealing with .resx files and namspaces.

Make sure that the default namespace for your Visual Studio project is the same as the class you are trying to access resources embedded in your .resx files from. We kept running into problems if the two were not the same in one of our custom web controls. It appears that when .NET puts your resources into the manifest of your Assembly, it associates them with the default namespace of the project somehow. (I'm not entirely sure how this is all accomplished. I'll see if either I or my co-worker can hunt down someone at MS who can give me a better explanation.).

The error you will get is long and generic, something about how the resource could not be retrieved for the given culture. I've just re-imaged my work machine, once I finish installing everything I'll replicate the error and the solution, posting the code and error message here.

Filed under: .NET, C#, General, VB.NET 3 Comments
17Mar/054

What gets me when I’m switching from VB.NET top C#?

Visual Basic .NET <--> C#

For me it's all the simple stuff. I don't know how many times I've typed in string _name; in a VB.NET class and gotten an error.

What really gets me though is all the damn TYPING I have to do when I'm just trying to inherit from a class or implement an interface and define out it's methods. Thank god the IDE will fill in the interface methods for me. Even when it does, there's no consistancy. I hit tab in C# but in VB.NET I have to hit enter. Then I have to go delete the linebreak that hitting enter puts in. That's annoying.

All of the shadows, implements, inherits, notinheritable, blah, blah, blah, etc... crap really keeps me from enjoying programming in VB.NET. Too much typing.

Filed under: C#, VB.NET 4 Comments