VB.Net Multiple Key Dictionary Example

How to define a Visual Basic dictionary with multiple keys

vb.net Multiple Key Dictionary
By definition, a Visual Basic dictionary represents a collection of keys and values. With a little coding, we can define our dictionary to use a multiple value key. A Visual Basic dictionary with multiple keys works great for organizing data where multiple keys are needed. Adding to, updating and accessing the dictionary is very simple and fast. Visual Basic dictionaries provide multiple Methods – See Dictionary(Of TKey, TValue) Class for more information.

The following is a pared down Visual Basic (.Net) program example of a multi-key dictionary.

I used this multiple key dictionary on a financial report I worked on. The report needed to collect a decimal value that varied based on a specific set of unique keys. Tracking values with multiple keys is not uncommon and there are several approaches you can take to programmatically track values with multiple keys. I found the use of a Visual Basic dictionary to be perfect for the task. In our example we’re going to cover constructing the dictionary, constructing the key set, comparing the key set for a match, adding to the dictionary, updating the dictionary, removing an item from the dictionary and lastly looping through the dictionary.
Continue reading “VB.Net Multiple Key Dictionary Example”