April 15, 2000

Quickly create HTML tables from an ADO Recordset

The ADO Recordset object exposes the GetString method, which returns the values in the Recordset into a formatted string. Here’s its syntax: res = GetString([StringFormat As StringFormatEnum = adClipString], _ [NumRows As Long = -1], [ColumnDelimeter As String], _ [RowDelimeter As String], [NullExpr As String]) As String This method is

Register and unregister components with context menus

The stardard method to register and unregister ActiveX component is running the REGSVR32 utility, which forces you to bring up the Start|Run dialog and manually type the command line. A much better approach is to have the Register and Unregister commands right in the context menu that appears when you

Programmatically register an ActiveX control or DLL

All ActiveX DLL or OCX export two functions: DllRegisterServer and DllUnregisterServer. They are used to register and unregister the ActiveX in the Windows registry, and are usually invoked from regsvr32.exe at registration time.However, you can register and unregister these files programmatically whenever you want to, provided that you know the

Copy the contents of the WebBrowser control to the Clipboard

To programmatically copy text from the WebBrowser control you can use its ExecWB method, to which you must pass the OLECMDID_COPY constant as its first argument. WebBrowser1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT You can also select the entire WebBrowser’s contents by invoking the ExecWB method with the OLECMDID_SELECTALL constant. For example, you can

Print the WebBrowser’s contents

The WebBrowser control doesn’t expose any method to directly print its contents. You can achieve this effect through the ExecWB method, by passing the OLECMDID_PRINT constant in its first argument: ‘ display the Print dialogWebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER You can also immediately print the current document in the WebBrowser without displaying

Download and save an HTML page with the Internet Transfer control

You can easily download an HTML page by using the Internet Transfer Control (INet). Here’s a reusable routine that uses this control to download the HTML page at the specified URL and optionally save it to a local file. In either case the routine returns the contents of the page

Register and unregister type libraries

All COM-oriented VB developers know how to register and unregister an ActiveX DLL, using the REGSVR32 utility. However, there is no such an utility to register and unregister a type library. You can quickly build your own TLB Registration utility with a handful of statements, thanks to the undocumented TLBINF32.DLL

Open MS-DOS prompt from any directory in Explorer

By adding a couple Registry keys you can add a commond to the context menu that appear when you right-click a directory when inside Windows Explorer. The new command lets you open the MS-DOS prompt and navigate to that directory with just one mouse click:Start of the REG file REGEDIT4[HKEY_CLASSES_ROOTDirectoryShellDosPrompt]@=”Run

Retrieve the textual or HTML text contained in a WebBrowser control

Here’s a quick way to retrieve the textual (that is, without any HTML tag) contents of a WebBrowser control: Dim Text As StringText = WebBrowser1.Document.Body.InnerText Getting the HTML text is a tad less intuitive, though: Dim Text As StringText = WebBrowser1.Document.documentElement.OuterHTML The following procedure let’s you save the contents of

No more posts to show