Using objects as key in HashTable

Written by Ingmar Verheij on March 20th, 2012. Posted in VB.Net

A HashTable can be used to store a collection of key/value pairs. The key object is used to uniquely identify the key/value pair which makes is easy to store data like a database.

The type of the key object which is added to the HashTable is variable. It can be an integer, a string, a GUID etc. Because of the nature of a GUID (a globally unique identifier) it is an ideal candidate for a key object.

If you want to use a combination of two (or more) GUIDS as a key object you can create a class object, but there is a caveat.

DataSet.ReadXML throws DirectoryNotFoundException

Written by Ingmar Verheij on March 14th, 2012. Posted in VB.Net

A .NET application that reads a dataset from an XML using the DataSet.ReadXML method might throw the exception : System.IO.DirectoryNotFoundException: Could not find a part of the path ‘<path of XML file>’.

According to MSDN this exception is thrown when when “part of a file or directory cannot be found” .However, this exception is not only thrown when a file cannot be found on the disk. The exception is also thrown when the structure of the XML is invalid (for instance because you didn’t close a node)

Compute numeric values in arrays with System.Linq namespace

Written by Ingmar Verheij on June 15th, 2011. Posted in VB.Net


Microsoft .NET Framework can store values in an array which makes it easy to use in methods and properties. An array can contain any kind of object, but I most commonly use it to store numeric value.

A greate property of numeric values is that you can compute them to a different value, and use that value to derive conclusions of any kind (I might sound like a madman , but figures somehow interest me).

A simple example of computing numeric values is deriving the lowest number is a range of number or the average of all numbers. .NET has a method that can compute this easily for you, but it’s a bit hidden)

Let’s take the following range of numbers: 0,1, 2, 3, 4. The lowest number in this range is 0 and the average is 2 (0+1+2+3+4 / 5). That’s easy.

True is not true (?)

Written by Ingmar Verheij on October 21st, 2010. Posted in VB.Net

The string 'True' is not a valid Boolean value.
This error is thrown when an XML file is read into a DataSet using “System.Boolean” as DataType.