Visual Studio > Creating your First Project

2015-09-03

This applies to Visual Basic and C#.

There are a few best practices that should be done when you are creating a project in Visual Studio.

  1. Start by selecting File > Project (CTRL + SHIFT + N)

Visual Studio New Project dialog

  1. Select the language you want to create your project in
  2. Select the project type you want
  3. Change the Name of the project to be something describing the work you are going to do
  4. Click OK

It is preferable to name the project at this point then to attempt to rename the project after it has been created.

Continue reading

VBA: Have Option Explicit be Automatically Added

2014-02-23

VBA allows you to adopt a few lazy habits that can come back to haunt you later on. One of these is not needing to declare your variables prior to using them. Since VBA requires variables to have a type this leads to possible type confusion (you attempt to store the wrong type of value into a variable) and code that is more difficult to read.

Adding Option Explicit to the top of your modules forces you to declare your variables (the IDE will prompt you when you forget). You can set-up the IDE to automatically add this option so you don’t forget.

In the VBA IDE go to Tools > Options

Ensure that Require Variable Declaration is checked. All new workbooks and modules will have Option Explicit added.

Note: Your existing workbooks will not have Option Explicit added automatically. You will need to add it in manually (and fix up any missing declarations).

Continue reading

Slow down to speed up

2014-01-08

We’re in the middle of a cold spell here in Ontario and the roads are slick with slush. Driving home from work my car was having trouble making it up a hill. With other anxious drivers behind me and me being stuck going 20 kph my gut reaction was to push harder on the gas. If you live in frosty regions, you’ll know that only makes it worse. The best option is to let up on the gas, let the wheel’s catch and start again.

Ease up. Get your bearings. Slow down to speed up.

Continue reading