devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

Check for NULLs Returned from DLL Calls

After a call to a DLL, the return value often contains a null.One way to eliminate the null is to look for Chr$(0), as in theexample: Dim CheckForNull As IntegerCheckForNull

Monitor Resolution Through API

There is a simple way to get Monitor resolutions through a WinAPIcall. Declare this in a module: Declare Function GetsystemMetrics Lib “User” (ByVal _ nIndex As Integer) As Integer And

Unload All Forms

Public Sub UnloadAll()Dim f As Integerf = Forms.CountDo While f > 0 Unload Forms(f – 1) ‘ If form isn’t unloaded exit (User had canceled…) If f = Forms.Count Then

A Replacement For Tabs

You say you want to use a tab control, but you have so many topics thetabs will be unreadable? Try using a list box in conjunction with a controlarray of

Jump To A Function Within Your Project

When you are looking at code that calls a function or procedure andyou are not sure in which module the function or procedure is defined,you can highlight/procedure name and press

Dragging A Form By A Control

This code is reusable and small enough to paste into whatever you’redoing and instantly have a form that has no need for a title bar. In thegeneral declarations section, insert

Printer Object Quirk

You would think that the following code would change the current fontof the default printer, but it doesn’t under VB4: Printer.FontName = “Arial”Printer.FontSize = 11Printer.Print “This is a test.” An

Using Components

Creating a new project with a lot of old components? In VB 4.0 you candrag and drop files into the project window to add them to the project.Use File Manager

Fix For Data Control Error 3426

This code, which works fine under VB3, may generate runtime error 3426–“Theaction was canceled by an associated object”–in the 16-bit versionof VB4: Private Sub cmdUpdate_Click() ‘ Save contents of bound

Error in DBGrid

The documentation for the DBGrid in VB4’s Professional and EnterpriseEditions states that the control’s Text and Value properties allow youto read or set the contents of a cell. This would

Programmatically Close The Binder Object

Because of customer complaints and confusion, Microsoft Office applicationswill begin to implement this strategy for programmatically closing Officeapplications. First, hide the object by setting Object.Visible to false.Then let the object

Error When Setting DBCombo MatchEntry Property

When you try to set the MatchEntry property of a DBCombo control to”1 – Extended Matching”(at run time or design time), VB may reportthat the “Property is read-only.” The problem

Change Your Editor Font

VB 4.0 lets you pick the font you want for your editor. You can do thesame thing in VB 3.0 as well, but you’re font choices are limited, andit’ll involve

Display The Windows Registered User

The strings related to the registered user of a particular copy of Windowsare stored in a string inside USER.EXE. You can retrieve them with code.In the general declarations section, insert:

VB3 Keyboard Shorcuts

Take a few moments to memorize these keystroke combinations and you’llfind yourself rocketing through your project! Key combinations separatedby commas mean they’re to be performed sequentially. VB 3.0 Keyboard Shortcuts

Compile On Demand

The new version of Visual Basic will compile only those portions ofcode it expects to run. This speeds load time, but the code may not befully checked. To fully compile

Early Binding With Microsoft Excel

Early binding can be done with Excel 5.0 and 7.0 by taking advantageof two bugs in Excel. The first bug cannot do direct early binding. Thesecond bug is an unexposed

Printing From The RichText Control

The on-line documentation on using the RichText control to print tellshow it is supposed to work. It does not mention two basic problems. First,the RichText control doesn’t work with the

Binding With Microsoft Word Type Library

The benefit of early binding is that performance improves and code doesnot need to be localized for each international version of Word. This istrue only for the function that is

Determine When An App Is Complete

In VB3, you call GetModuleUsage() to determine when an app you startedwith the Shell command was complete. However, this call does not work correctlyin the 32-bit arena of Windows NT

See The Methods Exported By An OCX

You can use the code window to see the events for an OCX, and the propertieswindow to see the properties of an OCX. To see the OCX’s methods, use theObject

Numeric Strings As Keys In A Treeview Control

To use numeric strings as keys in a treeview control, the keys mustbe strings containing a non-numeric character, not just digits. A handyworkaround is to append the string “_” to

Code All KeyPress Events in One Move

Do you need to tab through all those edit boxes? Are you tired of coding all of their KeyPress events? If so, set the tab indexes as you normally would.

Check Available Drive Space

The setup kit supplied with VB has a DLL with a useful function thatcan be called from your own applications. The function, GetFreeDiskSpace,returns the amount of free space available on

Load New OCXs, Error-Message Free

Normally, to load a new OCX, you select Custom Controls from the VB4Tools menu. Then, in the Custom Controls dialog, click on the browse button,select the OCX file, and click

Create Numeric-Input Text Boxes

In almost every application’s project you come across, fields necessitate the use of numeric text boxes-text boxes that should accept only numeric values. You can deal with this situation by

Error Handling In A Class Module

To signal errors from within a class method, use the Error.Raise methodand bubble it back up to the server. Check the docs for Error.Raise andthe books online. One caveat is

Setup Wizard Complains: Not Enough Info In OLE Server

The SetupWizard directly supports only self-registering OLE servers.The setup toolkit doesn’t directly support a server that requires a REGfile. A workaround is use the Add Files button to add an

Searching For 16-Bit DLLs in Windows 95

Windows 95 uses an extra step when searching for 16-bit DLLs. A newregistry key, “Known16DLLs,” in Windows 95 under \HKEY_LOCAL_MACHINESystemCurrentControlSetCon-trolSessionManagerfunctions in a similar way to KnownDLLs in Windows NT. Known16DLLs

Test for Leap Year

The tip “Leap Year Rules” [“101 Hot Tech Tips for VB Developers,” Supplement to the August 1996 issue of VBPJ, page 22] illustrated how to easily determine if any given