Artem's blog

Mainly .NET (C#, ASP.NET) and my projects

Archives for VB.NET

Investigating mod

Almost all languages have operators. Example of these are, “+” – addition, “-” – subtraction, “*” – multiplication, “/” division. There are also more advanced operators such as “Mod”, “Exponent”, and “And”. Let us investigate the mod.

I have seen that there are much misunderstanding about mod. Some claims that it performs a modulo operation, some claims that it is the reminder. Actually it is a reminder, and not a modulo operation.

In this investigation, I chosen Visual Basic as the default language. So, let us try to use mod operation as a modulo operation.

I would like to add that there is no problem to get the same answer back, i.e., 3 -4 mod 6 is -1, and then by adding 4 and again mod, will result 3. However, that is not the modulo. To display the modulo, use the function below:

In arrays, tables, indexes, where the index should be positive, we can use the function above.

Sample of Bubble sort

The MsgBox is there to show how it actually goes through the integer array. You can remove it as well!

CRC32 Method [VB.NET]

Please take a look over the code I’ve founded at
The author of this code is Tim Hartwig. If you want to read more about the code/algorithm, please go here!