Monday, June 2, 2008

Newest addition to the family

Yesterday we decided to add another member to the family,
abut the largest we have to day :)

Our newest member is Hector, the Shire horse.
(Yes they are large, but I like large horses and I like their character, just don't put your toes under the horse :))

Hector is one year old, but is already a decent size
(about 1m60, or in hands : 15.3 hands, or for you americans : 5.25 feet)



More pictures can be found : Here

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 @

Thursday, February 14, 2008

Connecting to an Access Database in Visual Studio 2008 Server Explorer

Trying to connect to an MS Access DB from the visual studio 2008 Server Explorer gave me a little surprise to see that the window I got to create the connection only gave me the possibility to type in the connectionstring myself.

Trying several possibilities, the test connection button always cleamed the connection was OK, but when clicking OK i received the following message :

format of the initialization string does not conform to specification starting at index 0
After a long search, the solution was found, something is incorrect in the registry :
- Open the registry using regedit
- Find the  "HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}"  in the tree
- Check if there is a subkey named ProgID there, if there is, you are not having the same problem as I had, but be sure to check the value

If the key is not there, add it :
- Right click the node and click new, key
- Name it ProgID
- Select the newly created key
- In the main (right) pane, doubleclick the "(Default)" value
- Set its value to "MSIDXS.1" (without the quotes ofcourse).

Now when you create a new connection to an access DB, you can use the correct window.

Tuesday, February 12, 2008

Clearing an Infragistics WebDateChooser

Clearing an Infragistics WebDateChooserThe infragistics webdatechooser is a very handy control for your website, easy to use and, as all infragistics controls, very configurable.

The only problem is when you filled in a value and want to empty the value, it retains the previously selected value. To really set the value to null, we can use its EditKeyUp event and a little javascript :

Change the control definition to (controlnames have been altered to protect the innocent) :
<igsch:webdatechooser id="wdcMyChooser" runat="server">
...
<clientsideevents editkeyup="webDateChooser_EditKeyUp">
<igsch:webdatechooser>


The name was kept generic, so that this function can be used for more than one webdatechooser on a page (or in an external javascript file or … )


Now all we have to do is add the Javascript function :

function webDateChooser_EditKeyUp(oDateChooser, keyCode, oEvent)
{
if (oDateChooser.getText() == "" oDateChooser.getText() == null)
{
oDateChooser.setValue(null);
}
}

And that is all there is to it, when the user clears the text from the wdc, the value inside is also cleared. At a postback we get the null value we wanted.