CanOz Blog

Neil Knobbe's Blog at vbCity

vbCity Blogs moved to:
http://cs.vbcity.com/blogs
  Home :: Syndication  :: Login

MayJune 2008Jul
SMTWTFS
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

Image Galleries

vbCity Blogs

Saturday, June 07, 2008 #

There are times when I have to wonder if I am the only person who does not know some things.

I ran into this self doubt again the other day when I was watching one of Ron Cundiff's VB.NET Soup To Nuts WebCasts.

During the WebCast one of the participants asked if there was a way to comment multiple lines of code.  When I heard this my ears perked up and I got very interested.

In the, almost, ten years that I have been writing code, I always have commented out any lines of code I didn't want to run one line at a time.  What a time consuming effort that can be depending on the number of lines you are working with.  I also ended up with unformatted (not indented) code,

and usually put the comment apostrophe in the wrong place when an indented line of code moved once the one above had been commented out.

Well this is all changed now.  Low and behold there are buttons in the Visual Studio IDE that let you comment out, or uncomment, any lines of code that you have selected.  All this time I had a simple way literally staring me in the face.

Right in the main Toolbar there is the Comment Button

and the Uncomment Button.

Now all I need to do to comment, or uncomment, multiple lines is highlight the code I want and click a button.

One other great thing about this feature is that the code stays formatted (indented) even after commenting which, I believe, makes it much easier to read.

*sigh*  Now I only have to wonder what other time saving “wonders” I will have to wait ten years to discover.

posted @ 2:00 AM | Feedback (3)

In a previous post, I showed you how you can deploy your application using ClickOnce.  Looking at how to deploy extra files, like my first look at ClickOnce, was prompted by a post on vbCity.

Now I will admit that I wasn’t as sharp answering the original question as I could have been so be gentle with your opinion of me if you read through the thread.  (In fact it took me two days to work out that when the person asking mentioned the "Publish" tab that they meant ClickOnce.  I guess this is what I get for trying to answer questions a 3:30am.)

Once I was in synch with the problem a little research provided me with an answer.

You would have thought that once you added the files to your project in Visual Studio that they would be automatically included in the deployment package but this is not the case.  I added the file to my project,

but if you were to then take a look at the files that are included in the deployment package by going to the Publish tab of your projects properties page and click the "Application Files" button you get a nasty little shock.

No additional file even though we have added it to the project.

The reason for this is that we have not told Visual Studio what we want to do with the file.  What is needed is to make one change to the properties of the file.  The property we want to change is the Build property.

By default, depending on the extension of the file, when you add a file to a Visual Studio project the Build property is set to "None".

(If you were using a deployment method like creating a Windows Installer file (.msi) then this would not be a problem because of the was you create the Installer file.  With ClickOnce deployment unless you change the Build property it assumes that you don’t want to include the file in the deployment package.)

In the properties window of the file select “Content” from the choices for the files Build property.

Now ClickOnce will recognize that the file is to be deployed with your application and if you go back to the My Properties page of your app, click on the "Publish" tab and click on the "Application Files" button you will see that the file in the list of files to be included.

Publish your application, then you can do a test install and you will see by looking at the files that are installed on your computer now include the additional files.

posted @ 1:30 AM | Feedback (0)