
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.
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)
Only one copy of a DLL can exist in memory at a time. For this reason, VB doesn’t allow you to create DLLs exposing single use instancing classes. An EXE,
In VB4 you can create a single Splash Screen or About Screen that workswith any program and automatically keeps itself up to date using the newproperties of the App Object.
Microsoft Word exposes the WordBasic object. Through this object, you can execute WordBasic statements. The WordBasic statements and functions can be used as methods of the WordBasic object. Most WordBasic
SQL Server does not return a result set for action queries (SQL insert,update, or delete statements). If you were to use the SQLExecute methodand execute the statement directly, RDO would
One of the greatest features of data-aware controls is that you simplyconnect them to a DataControl and select the fields you need. You havejust created a database program. It can’t
Nulls are still a problem in VB3/VB4-they cause unexpected errors. To handle them, you can read the MDB field into a variant, which can hold a null and then test
I’m programming for a LAN and quite often I add requested features to the program. The LAN is set up so that each workstation is running its own copy of
To build debugging and profiling into your code, add this to the endof code lines: ‘Code line Add this line (n should be replaced’by a unique number)i = j +
I speed up the debugging of applications with queries that return large record sets by using Access 95 to temporarily set the TopValues within the query stored in the MDB.
A VB3 form that has a fixed double border does not show the form’s icon in the upper left-hand corner if you have the control box set to True. Here’s
Use this code to find the binary representation of the currently checked check boxes: Function WhichCheck(ctrl As Object) As _ Integer’ This function returns the binary value ‘ of an
Use this code to find the index of the currently selected control in an array of option buttons: Function WhichOption(Options As _ Object) As Integer’ This function returns the index
The GetRows method retrieves multiple rows of a Recordset (JET) or rdoResultset (RDO) into an array. Ioften use this feature to transfer data between an OLE Server and client applications.
This function returns the difference between two dates on Years, Months, and Days: Function GetAge(dtDOB As Date, _ Optional dtDateTo As Date = 0) _ As String ‘is dtDateto passed