Microsoft Visual Studio LightSwitch – Installation

There is a lot of web talk on problems with existing SQL installations before installing LightSwitch

  1. LightSwitch 2011 requires SQL Server Express to be installed. It is looking for SQLEXPRES instance.
  2. If you already have SQL Developer edition you may have a problem. I tried to trick it by adding an instance to SQL Developer named SQLEXPRESS. This got past the LightSwitch install.
  3. However still could not use the program because it also requires User Instances, which are not possible in Developer. So Removed my SQLEXPRESS instance. To do this > Programs and Features > Microsoft SQL Server 2008 R2 (64-bit) then Remove. Don’t panic it asks if you want to uninstall an instance, so you can leave previous instances on there.
  4. Then installed SQLExpress side-by-side with my developer edition. All OK
  5. LightSwitch 2011 good to go!

Reading Command line arguments in VB.NET

Nice clear entry at:

In Project > My Project > Publish > Options > Deployment
Uncheck “Use “.deploy” file extension

Now after publishing you will get the .exe file. If you create a shortcut to this .exe file you can add command line arguments to it as shown in the image below:

 Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs


For i As Integer = 0 To CommandLineArgs.Count - 1

There maybe reasons why you may not want to uncheck this. Namely:;k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22)&rd=true


VS Bug on FormClosing datagridviewcomboboxcell value is not valid

Error message may be “Field called xxx does not exist”

Try this on Form closing

Private Sub frm_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    Me.MyGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
End Sub

I would hazard to suggest thatVisual Studio does not dispose of the datagridview in the correct sequence

This sometimes occurs when my personal code > SetUpDataGridView may programmatically set the AutoSizeRowsMode.


This link
Suggests it may be something to do with autosize, when there is a combobox created. The order of creation and setting may be important.

“If you autosize the column but have not provided the combo box column with a valid datasource or you haven’t yet added items to the combo box column’s items collection then you’ll get this error at startup because autosizing requires the cell’s FormattedValue to be requested. Requesting the FormattedValue of a combo box cell is where the check is done that may raise the data error exception you are seeing.

Set the autosize mode after you fill the combo box and things should be ok.

Mark Rideout – DataGridView Program Manager – Microsoft”

Or create the comboboxcolumn then clear the autosize modes > run > re-set the autosize mode.
Or programattically set the autosize after form has designer InitialiseComponent code has loaded.

Roaming and Outlook Email – Leave a copy of messages on the server

While I have accessed email from Outlook on my PC for years, I recently discovered that I could access my email from the web and this left a copy of the message on the server, so when I next used Outlook the message would be shown there as well. However as soon as it is received in Outlook it is no longer visible on the server.

My friend indicated that there was a method of leaving messages on the server. This is here:

  1. Tools >Email Accounts > View or change existing e-mail accounts > Next
  2. Select Account > Change > More Settings … > Advanced
  3. Delivery > Leave a copy of messages on the server
    • Remove from server after ( and I have currently chosen 10 ) days
    • Remove from server when deleted from ‘Deleted Items’ – I have chosen checked