Free Tool: Making Life Easier with Web Essentials

I mentioned this tool in one of my Practical JavaScript columns, but Web Essentials 2010/2012 are so useful to ASP.NET developers that I wanted to cover it here for everyone not reading that column. The primary difference between the 2010 and the 2012 versions is that the 2012 version does more.

More

Posted by Peter Vogel on 09/30/20130 comments


Visual Studio Tip: Use Ctrl_I for Quick Searches

This tip is mostly for Visual Studio 2010 users: stop using Ctrl_F. Ctrl_F brings up the Find dialog where you can type in your search text, press the <Enter> key to search, and (eventually) close the dialog because it's blocking your view. Instead, use Ctrl_i (for "incremental search"). After pressing Ctrl_i, just start typing and your cursor will skip to the first occurrence of whatever you've typed so far, no dialog required. Often you'll find your cursor sitting on what you were looking for before you've typed in everything you thought you'd need to find it.

More

Posted by Peter Vogel on 09/25/20130 comments


Writing Great Error Messages

I knew this, I really did, but I had to be reminded: A really good error message doesn't tell the user that something's wrong or even what it is that's wrong. A really good error message tells the user what they need to do to solve this problem.

You don't want to have your error messages say things like "Invoices cannot be processed" or even "Invoices cannot be processed: Invoices have different due dates." Those error messages just tell the user what's gone wrong (in varying levels of detail). Instead, tell the user what to do and then, if you want, what the problem is: "Only select invoices with the same due dates -- the selected invoices have multiple due dates."

More

Posted by Peter Vogel on 09/19/20130 comments


Is There Anything in that String?

String variables look like value types, those variables holding integers and dates. But, under the hood, strings are more like reference types, those variables that point to objects. This means that you can set a string to Nothing/null, something you can't do with integers (though you can with a variation on some value types). While a string variable set to Nothing/null is obviously a string with 'nothing there,' you probably also consider a string set to String.Empty or "" (a zero-length string, or ZLS) as 'nothing there.' In some conditions, you may even consider a bunch of blanks ("     ") as 'nothing there.'

More

Posted by Peter Vogel on 09/11/20130 comments


Working with Objects with the Window Form DataGridView

If you're using the Windows Forms DataGridView and loading data into columns by pulling that data out of properties on objects, you should know that there's an easier way. Just create a List of your objects and use that List to set the DataGridView's DataSource property. The DataGridView will generate a row for each object in the collection and column for each property on the class. Typical code would look like this:

More

Posted by Peter Vogel on 09/03/20130 comments


Free Tool: SharePoint Content Deployment Wizard

You know that when it comes to deploying your latest SharePoint solution, it's not enough just to move over your code/list/templates/WebParts/etc. Often you need to have specific content in your production SharePoint site to support your new application. The SharePoint Content Deployment wizard helps you leverage the Content Migration API to generate a cmp file holding the content needed for your deployment.

More

Posted by Peter Vogel on 08/28/20130 comments


Check for Changes Between Collections with SequenceMatch

You'd prefer not to execute any update code more often than you absolutely have to. If you only have one object to deal with, checking to see if an update is required is simple: retrieve the corresponding object from the database, check to see if the two objects have different values in their properties, and update the database only if there is a difference.

More

Posted by Peter Vogel on 08/08/20130 comments


Free Tool: Don't Reset Your CSS, Normalize It

Standards must be wonderful things; after all, there are so many of them. And there's a different standard for CSS defaults for every browser. As a result, if there's any relevant CSS setting that you don't supply a value for in your CSS, your perfectly good stylesheet will cause your page to display "uniquely" in every browser (and unique is never good).

More

Posted by Peter Vogel on 07/30/20130 comments


Visual Studio Tip: Extend Your Most Recently Used List

The most recently used (MRU) lists on Visual Studio's menu list the last 10 projects (or files) that you worked on. However, I'm sometimes working on multiple projects for multiple clients simultaneously (please don't tell them: each one thinks they're exclusive). As a result, I have many projects on the go and often have trouble remembering which one I'm working on for any particular client.

More

Posted by Peter Vogel on 07/24/20130 comments


Control Testing for Equality with the IEquatable Interface

When you use the equals sign (=) or the Equals method to compare two objects, you're probably doing a reference comparison: You're asking if the two variables being compared are pointing to the same single object in memory. That may not be what you want.

What you may want is to compare two different instances of the same object to see if the two objects represent the same business entity. As an example, you might compare the variables Customer1 and Customer2, both of which point to Customer objects, to determine if both Customer objects represent the same customer. In that case, you want to do a value comparison: You want to ask if the two objects that the variables point to have identical values in their properties.

More

Posted by Peter Vogel on 07/16/20130 comments


Selecting Items from a Collection using Another Collection with LINQ Joins

Here's the problem: you have a collection of objects with lots of information in those objects (the "rich" objects). You also have a collection of objects that represent a selection your user made in your application's UI (the "selected" objects). Unfortunately, your "selected" collection is a different and less useful set of objects; you really want to work with the "rich" objects. So Your problem is finding all the matching objects from the "rich" collection, based on the objects in the "selected" collection.

More

Posted by Peter Vogel on 07/08/20130 comments


Use the Enum Object to Manipulate Enumerated Values

When it comes to writing Really Obvious Code, Enums are a tremendously easy way to make your code understandable. In the bad old days, when working on someone else's program I'd be forced to decode code like this:

More

Posted by Peter Vogel on 06/28/20130 comments


Subscribe on YouTube