
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.

To test whether a date falls on a weekend, you might be inclined to do this: nDay = weekday (sDate)If (nDay = 1) or (nDay = 7) Then ‘It’s a

These two routines enable you to get the height of an item of a list box in terms of pixels, and they also enable you to set the height of

Creating an object that looks and acts like a collection is a good wayto implement a form of inheritance in VB4, where inheritance is not providedby the language. Creating properties

In many places, I include Error$ as picked up in an error trap in a descriptive message. I use a function to expand its meaning. I call the function TSS

Assume that you have the full path name of a file, and you need to beable to tell if the drive is writeable (that is, if it is a CD-ROM

While developing MDI applications in VB 4.0, you probably have noticed that the cursor on the MDI child disappears when you click on the toolbar on the MDI parent. You

Microsoft is currently working on a printing problem. Visual Basic 3.0 applications running in Windows 95 cannot print to shared printers with an embedded space. If a shared printer has

The StartMode setting in the Options dialog of the Tools menu in VB4determines only whether an application with no startup form continues torun after Sub Main has completed. This allows

When in NT or Windows 95, use the Sleep API function instead of DoEvents.DoEvents does this: while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg);} DoEvents spends part of its

Add a method in VB 4.0 to center your forms against the screen or aparent form. Create a new project with two forms. Add this code to Form2: Public Sub

Use the Tools-Custom Controls dialog instead of Tools-References toremove controls. The project file will show references to all custom controlsin the project’s toolbox, even if they are not used by

VB4 allows you to create data structures that are more dynamic than previous versions allowed, thanks to the possibility of having dynamic arrays within types. For example, a tree structure

Add Optional parameters to your procedure calls. Both Functions and subs can now use the Optional keyword in the declaration to indicate that the following parameter is optional: Function mfbCheckDBStatus(Optional

To line up controls on a form in VB4, select all the controls you want to line up. Press F4 to bring up the properties window. Then double-click on the

Working with control arrays in VB3 was frustrating, but with VB4 youcan pass a control array as an argument to a function. Simply specify theparameter type as Variant: Private Sub

How many times have you wished field objects had a “RequiredIfCondition1″or other user-defined property? You can add one easily: Set NewProperty = Field1.CreateProperty(“FieldNote”)NewProperty.Type = dbTextField1.Properties.Append NewProperty

In many applications, I want to make absolutely sure that the data in a Jet table doesn’t get modified under any circumstances. I hard-lock the table in addition to using

Have you ever wanted to push a variable onto a form without using atag? Property functions let you create custom properties for forms or classmodels. Use PropertySet, PropertyGet, and PropertyLet

You have a VB4-based OLE Automation server that has no main UI, anddisplays forms that are parented into Excel in response to various automationcalls. Sometimes you need to display a

Use the Tag property and the MouseMove event to create “tag tips”which look like tool tips. Create a label to be used as the tool tipbox and set its visible

In Windows 95, only the VB windows with the property ShowInTaskbar setto True are minimized if you select Minimize All Windows from the taskbar context menu. This is the way

Don’t set the MousePointer in an OLE DLL unless absolutely necessary. The in-process OLE server can not retrieve the current mouse pointer, so there is no way to set it

When you need to reset your tab indexes quickly (without buying a third party VB extension product), set the tabs in the reverse tab order assigning each tab index to

You have an object variable declared in the Declarations section ofa form. In the Form_Load event, you create an instance of a class and assignit to the variable. However, when

Do you have a module or class of the same name as a system-providedobject? If so, VB will use your object, not its own. In VB3, where youcouldn’t define your

I’ll present this tip the VB3 way and the VB4 way. I beat myself fora couple of hours over this routine to convert a string to Title Case.I used this

The Properties collection of many data access objects is very helpfulwhen debugging. Execute this code from the debug window: For i = 0 to Recordset1.Properties.Count- 1:Debug.Print _ Recordset1.Properties(i).Name &Recordset1.Properties(i):Next

Use object substitution to substitute a simple name with an extendedobject reference. Each “.” in the syntax represents an OLE lookup.Better performance is achieved the fewer times lookups need to

You create a routine that uses the Typename() function to find out thetype of an object, and based on that type, performs certain actions. However,when used in a Form object,

Here is a simple way to extract file names from file specifications: Function FName (filespec As String) As String Dim i As Integer Dim size As Integer size = Len(filespec)
