Home

Shuffle a string in VB.Net

In this tutorial/code example I’m going to show you a method to shuffle the contents of a string. You might use this for something like an anagram game. Private ran As New Random Private Function randomizeString(ByVal input As String) As String Dim rtn As String = "" Dim i As Integer While input.Length > 0 i = ran.Next(0, input.Length)...

Read more

How to find out current class/method name

In this short code example I’m going to show you a method to identify what class (including the namespace) you’re currently in and what the name of the current method is. You can also use this technique to find out more information about the method but I won’t go into that detail here. System.Reflection.MethodBase.GetCurrentMethod().ReflectedTy...

Read more

How to compress and decompress a file in VB.Net

In this tutorial/code example, I’m going to provide you with a piece of code to compress and decompress a file in VB.Net without using any additional libraries. Option Explicit On Option Strict On Imports System.IO Imports System.IO.Compression Namespace FileSystem Public Class Compressor ''' <summary> ''' This metho...

Read more

Comparing two images to see if they are the same

In this tutorial I’m going to show you how to compare two images to see whether they are the same or not using C#. /// <summary> /// This method deals with checking whether the two bitmaps that are passed to it are the same or not /// </summary> /// <param name="img1">The first image</param> /// <param name="img2">...

Read more

Tell if Microsoft Office Save As PDF add in is installed

In this VB.Net Tutorial/Code Example I’m going to show you how to check whether the Microsoft Office 2007 Save As PDF addin (available from here) is installed. Public Shared Function isPDFSaverInstalled() As Boolean Dim rtn As Boolean Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("SoftwareMicrosoftWindowsCurrentVersionUninst...

Read more

Is Excel installed and what version?

In this VB.Net Tutorial/Code Example, I’m going to provide you with a simple class that allows for you to check whether Excel is installed on the computer and also figure out which version of the Excel it is. The version function uses late binding. Imports Microsoft.Win32 Namespace MS.Office Public Class Excel Public Shared Functi...

Read more

Is Word installed and what version?

In this VB.Net Tutorial/Code Example, I’m going to provide you with a simple class that allows for you to check whether Word is installed on the computer and also figure out which version of the Word it is. The version function uses late binding. Imports Microsoft.Win32 Namespace MS.Office Public Class Word Public Shared Function ...

Read more

Is Access installed and what version?

In this VB.Net Tutorial/Code Example, I’m going to provide you with a simple class that allows for you to check whether Access is installed on the computer and also figure out which version of the Access it is. The version function uses late binding. Imports Microsoft.Win32 Namespace MS.Office Public Class Access Public Shared Fun...

Read more