Category: .Net

Did you know… Visual SourceSafe “Keyword Expansion Support”

Although we’re not using SourceSafe at my current project (yet), I found out about a cool feature recently: Keyword Expansion. It enables you to get information about the revision, date, author and so on of the version of the file you are looking at inside the file itself. This way you can see version information in the comments of your code-file, …

Read More “Did you know… Visual SourceSafe “Keyword Expansion Support””

ComboBox trouble

The default ComboBox has some weird characteristics… We created our own control which derives from the ComboBox because we wanted to create a ComboBox where the user could type (parts of) the value he or she wants to select, but would not be able to type something that was not in the list. So that’s kind of a combination …

Read More “ComboBox trouble”

HOWTO: display your assembly @ Add Reference

You might want to be able to let your assembly show up in the Add Reference window in Visual Studio without the user having to browse for it. When you install your assembly in the GAC, it doesn’t automatically show up in the Add Reference window, because it doesn’t enumerate all assemblies in the GAC. …

Read More “HOWTO: display your assembly @ Add Reference”

A failure occurred writing to the resources file. The system could not find the file specified.

We received the above error for the resx file of a form in our project today. So we checked the existence of the resx file it concerned, and it was there. So maybe the file was corrupt? We deleted the file, removed it from the project and let Visual Studio re-create it by editing the form in the …

Read More “A failure occurred writing to the resources file. The system could not find the file specified.”

A custom SOAP fault handler and a ‘Reference not set to an instance of an object’ error …

Today we had a problem on the project I am working on. To be more precise: I had a problem, the other team members did not.Quick explanation: We have a server component which uses a web service for some of the functionality we need. Other functionality can be found in a different system which is reachable through IBM …

Read More “A custom SOAP fault handler and a ‘Reference not set to an instance of an object’ error …”

Visual Studio .NET Bootstrapper

Have you ever made an install for your application with Visual Studio and sent it out into the world, only to get complaints of people that your software wouldn’t run?“Have you got the Microsoft .Net framework installed?”“The what?”“Go look in control panel, …… ……”“Ow, yeah, I got that””Hmmm….””So ehm….””What version is it?””Version? …. wait …. it’s …

Read More “Visual Studio .NET Bootstrapper”

Controls disappear from the Windows Forms Designer in VS2k3

We recently ran into the problem mentioned in the title of this post at work. Microsoft has a knowledgebase article (kbid 842706) for this bug. The hotfix is not to be distributed freely, but I already spoke to some people who have contacted Microsoft and got the fix for free. It will be e-mailed to you.As you …

Read More “Controls disappear from the Windows Forms Designer in VS2k3”

HOWTO: Encode a password using MD5 in C# (or: howto calculate the MD5 hash for a string)

The following method returns the MD5 hash for any given string. For instance for a password. It might be of some assistance when you’re trying to validate user credentials but you don’t want to store the password readable in the database.For this method, you’ll need the following using statements:using System;using System.Text;using System.Security.Cryptography;…public string EncodePassword(string originalPassword){  //Declarations  …

Read More “HOWTO: Encode a password using MD5 in C# (or: howto calculate the MD5 hash for a string)”

Commenting your code – The sequel

As Ernst put it in the comments: we opened a can of worms here!In my previous post about Commenting your code, I stated you should not comment your code. Of course, this is nonsense. The reason I stated that, however, isn’t. And I didn’t only say that because I would get some attention 😉Too many …

Read More “Commenting your code – The sequel”

Commenting your code

There are several ways to comment your code. There’s the style where you place comments on the same line as the code. This might get less readable, because there’s some horizontal scrolling involved when your statements get longer. An example:string s;               //Declare string s = e.Message;          //Assign exception message to string s Another way to place …

Read More “Commenting your code”

HOWTO: Draw your own string (URL, copyright) on each displayed picture in an ASP.Net website

The AdRotator .Net provides can be used to show a different image each time a page is visited. You could write a webpage which does this for you, but it’s probably not very useful. Although you need to change the XML file when changing the images to be showed when you use an AdRotator, but that’s …

Read More “HOWTO: Draw your own string (URL, copyright) on each displayed picture in an ASP.Net website”

HOWTO: create an animated GIF using .Net (C#)

.Net (at least 1.1, they might incorporate it in 2.0) does not give you possibilities to create animated GIFs through GDI+. But there are ways to make them! This solution is one I used myself, and I’m very pleased!//Variable declarationStringCollection stringCollection;MemoryStream memoryStream;BinaryWriter binaryWriter;Image image;Byte[] buf1;Byte[] buf2;Byte[] buf3;//Variable declarationstringCollection = a_StringCollection_containing_images;Response.ContentType = “Image/gif”;memoryStream = new MemoryStream();buf2 …

Read More “HOWTO: create an animated GIF using .Net (C#)”

Configuring an ASP.Net app for multiple login locations with forms authentication

The title isn’t descriptive enough for this post, but it will have to do. Today I was trying to get an ASP.Net application to allow me to define two different login levels. What I was trying to do was the following:   There’s a main ASP.Net application, which is allowed to be accessed by anyone …

Read More “Configuring an ASP.Net app for multiple login locations with forms authentication”

Visual Studio Powertoys!

I stumbled upon a great workspace at GotDotNet: Visual Studio Core Community Powertoys. Here you can find some pretty neat powertoys for the Visual Studio IDE. For example:Go Back Visual Studio Add-InThe Go Back Add-in provides a Navigate Backward functionality that is different than the normal Navigate Backward functionality. (Which does some neat things like close …

Read More “Visual Studio Powertoys!”

Regular expression tools

At the Powertoys WebLog, Sara Ford posted about a very cool tool which is available at gotdotnet: Regex Builder.At gotdotnet it is described as follows: “A tool for building and testing Regular Expressions. It allows you to manipulate the expression and your source text, and shows you a tree with all of the Matches, Groups, …

Read More “Regular expression tools”