I figured it out by converting some C# code to VB.NET.

http://www.dotnet247.com/247referenc.../18/90440.aspx