Thursday, May 15, 2008

Visual studio 2005 toolbox icons messed up.

When I started VS 2005 today I noticed all my icons where messed up :



This makes finding the right control a little harder.

The solution is quite simple : Right click the toolbox and choose reset toolbox,
and presto , icons back.  Unfortunatly this also removes any custom items and tabs in the toolbox.

I also read that deleting all tlb files in  C:\Documents and Settings\_username_\Local Settings\Application Data\Microsoft\VisualStudio\8.0 can work, but did not try it myself.
I don't know what other things might be removed when you delete these files, so be carefull!

 

Wednesday, May 7, 2008

Problem adding files to deployment project

For some time now I have had problems adding files to the file system editor portion of a deployment project.

When I right clicked, add file, browse for a file, any file (dll / jpg / xml / txt / ...)
It would not add this file to the project,

Luckily there are workarounds for this issue (no definite fix found yet) :
- the simplest is just closing and reopening visual studio
- Rebooting your pc may also work
- Adding a shortcut to the file (which will add the file also), and deleting the shortcut (I have not tried this yet myself)
- Resetting your visual studio settings can also help (also haven't tried this myself)
- Some even say that reinstalling fixes this problem (which will ofcourse open & close visual studio and reset the settings ;-) )

Monday, May 5, 2008

Getting the temp folder in c#

Another reminder to myself :

To get the temp path in c#, the most used option I have seen is :

string tempPath = Environment.GetEnvironmentVariable("Temp");

which works ok most of the time, but personally I don't like to pass string variables around,
so I went looking for something as :
string tempPath = Environment.GetFolderPath(SpecialFolder.Temp);
which ofcourse does not exist.

But as with google as a friend, I found the best way (for me) :

String tempPath = Path.GetTempPath();

(always in the last place you look of course ;-) )

Using double quotes in c#

As a 'convert' (rather forced) from VB.NET to C# I always miss how to use the double quotes in a string, so here just as a reminder to myself :
use the @ symbol before the string or doubling the quotes won't help:

string myString = @"SomeText which needs a ""quote";

ofcourse, at the beginning of the string or the end of the string just triple the quotes :
string myString = @"SomeText which needs some ""quotes""";

But the most important is : use the @