August 31, 2002

BrowseForFoldersDialog – A class to display the BrowseForFolders dialog box

‘ a class to display the BrowseForFolders dialog’ usage:’ Dim diag As New BrowseForFoldersDialog()’ diag.Description = “Select a directory”‘ If diag.ShowDialog() = DialogResult.OK Then’ ‘ the user selected this directory’ directory = diag.Path’ End If” IMPORTANT: requires a reference to the System.Design.Dll assemblyClass BrowseForFoldersDialog ‘ the Description that appears in

Trapping DHTML events from the WebBrowser control

You can host the WebBroweser in a Windows Forms application, similarly to what you can do with any other ActiveX control. You just need to right-click on the control toolbox, select the Customize Toolbox menu command, select the Microsoft Web Browser control from the list of available controls, and click

Resolve an internet host address

The System.Net.Dns class exposes a few static methods that let you resolve an internet domain name – such as www.vb2themax.com – into a 4-part numeric IP address, also known as dotted-quad notation.The Resolve static method takes a string and returns an IPHostEntry object; you can learn the actual IP address

A cheap way to display files and hex data

The .NET framework includes a ByteViewer control, that you can use on your own forms to display data stored in a Byte array or in a file. The ByteViewer control can’t be added to the control Toolbox, though, so you must instantiate it through code only. ‘ IMPORTANT: this code

Right-align formatted strings

The String.Format function supports many formatting options, but none allows you to display right-aligned columns of numbers, as in: 1.00 12.00 123.00 1,234.00 However, you can easily create a helper function that works like String.Format, takes an additional length argument, and aligns the result to that length: Function RightFormat(ByVal formatString