The Latest

DevX - Software Development Resource

Set Forms to Nothing with Caution

It’s a good idea to set your form variables to Nothing to recoverall memory that was allocated for the form module. Executing SetForm1 = Nothing for a loaded form, however,

DevX - Software Development Resource

RegEdit Addition “Automation”

This sample file from Microsoft allows a more automated Windows95 Registry Addition. You can create a similar file in Notepador your favorite text editor, replacing the appropriate entriesin place of

DevX - Software Development Resource

Sizable Forms Without a Title Bar

If you set a form properties caption to “” and controlbox to False, then a form with borderstyle 3 (fixed dialog) willdisplay without its title. Unlike borderstyle zero (none), itkeeps

DevX - Software Development Resource

Securing a Jet Database the Right Way

To secure a Jet database, you must purchase Access 2 for VB3/VB3-16or Access 95 for VB4-32 and follow these steps: Use the Access Workgroup Administrator to create a new workgroupwith

DevX - Software Development Resource

Editing the Regular Grid

The regular grid that comes with Visual Basic cannot be editeddirectly. However, this problem can be easily circumvented withone line of code: Private Sub Grid1_KeyPress(KeyAscii As _ Integer)Grid1.Text = Grid1.Text

DevX - Software Development Resource

Blanks in the Masked Edit Control

The Microsoft Masked Edit control only allows input that matchesthe mask. Similarly, you can only set the Text property to a stringthat matches the mask. If you have a mask

DevX - Software Development Resource

Enforce Uppercase Characters

Do you want to facilitate the user to enter only uppercase charactersduring editing in text boxes and other edit controls? Irrespectiveof the position of CAPS LOCK key, this code in

DevX - Software Development Resource

Add ‘Type Ahead’ Functionality to Combo Boxes

You can add ‘Type Ahead’ functionality to the standard VB ComboBoxcontrol with this subroutine: Sub ComboTypeAhead(Combo As ComboBox)Dim i As Integer, _ KeyString As String, _ KeyLen As IntegerKeyString =3D

DevX - Software Development Resource

Tab Order with Labels Attached To Controls

In order for a label to be associated with a control (such as a textbox) for using hot keys, they must be in TabOrder sequence, the label beingone more than

DevX - Software Development Resource

DBGrid Automatic Configuration

If the layout of VB4’s DBGrid is not changed at design time, it willautomatically configure to a new record set when the Data control is refreshedwith a new RecordSource. Related

DevX - Software Development Resource

Unloading The Server From Memory

Shut down the instance of Visual Basic that uses the compiled in-processOLE server to unload the server from memory. Changes to the in-processOLE server will not be seen until the

DevX - Software Development Resource

Beware Of Design-Time DDE Links

When using DDE Links at design time, the link will be temporarily cutwhen the program is run. Some, but not all, programs will reestablish theconnection. Related Posts Making a File

DevX - Software Development Resource

Speed Crystal Reports

If Crystal Reports’ speed is lacking although your report contains nolarge graphics or large numbers of groups, change these two lines in yourCRW.INI file to solve disk swapping problems: MaxRecordMemory=0MetapageSpillLimit=100

DevX - Software Development Resource

MSDN Is Indispensible For Those Off-The-Wall Errors

Use the Microsoft Developer Network to search for errors that seem to defy explanation. VB4 comes with a short version of the MSDN, and subscriptions are available through Microsoft. Related

DevX - Software Development Resource

VB 4.0 Keyboard Shortcuts

Note that some key combinations are different from those for VB 3.0:Ctrl-T–Custom Controls. Ctrl-E–Menu Editor. Ctrl-F–Find (Unchanged from VB3). Ctrl-H–Replace (H? Yes, H! Go Figure!). Related Posts Sort a List

DevX - Software Development Resource

Printer Object EndDoc Resets FontName

The Printer object’s EndDoc method resets the FontName property. Ifyou want your application to print separate documents, invoking EndDocat the end of each, set the FontName before printing the first

DevX - Software Development Resource

OLE Server Object Manipulation

Don’t return references to Form and Control objects from your OLE server.Rather, provide wrappers for the properties and methods of forms and controlsif they must be manipulated by your OLE

DevX - Software Development Resource

Append a String to a Text Box

Use this code to cause a TextBox control to automatically scroll down as you concatenate new text: ””Select the end of the text MyTextBox.SelStart = Len(MyTextBox.Text)””Put the new text thereMyTextBox.SelText

DevX - Software Development Resource

Use The Most Specific Type Available

Instead of declaring an object As Object, use the specific object type, such as CTask. This improves performance by minimizing the OLE lookup requirements. Related Posts AssertionSET ARITHABORT ONHow to

DevX - Software Development Resource

Use

Use an ampersand (&) instead of a plus sign (+) when concatenatingstrings. Depending on the data type of the operands, using the plus signmay result in an addition. Related Posts

DevX - Software Development Resource

Watch What You Pass To Your OLE Servers

Don’t use any objects in the Visual Basic object library as parametersor return values for exposed properties or methods in public classes. Theseobjects are not intended to be used from

DevX - Software Development Resource

Minimizing The Number Of Repeated OLE Lookups

Use With…End With to minimize the number of repeated OLE lookups.This has the added advantage of not requiring the temporary substitutionobject. Related Posts Find the TLS Version a Vendor SupportsBlue

DevX - Software Development Resource

Optimize Label Creation

Place one label on your form, tailor its properties (such as left-alignand autosize), and copy and paste it to create the rest of your labels. Related Posts GitHub Analysis Shows

DevX - Software Development Resource

Initializing An In-Process OLE Server DLL

Start the in-process OLE server using a Sub Main procedure. Includeall server initialization code in the Sub Main procedure. Don’t show formsfrom the Sub Main procedure and don’t use the

DevX - Software Development Resource

Be Aware, It’s Not C!

VB developers that program with C language might be confused by a feature in the language. Consider thiscode: Dim x As IntegerDim y As IntegerDim z As Integer x =

DevX - Software Development Resource

Set All Object Variables To Nothing

Do set all object variables to nothing before ending the application.When the End statement is executed in the OLE client application, the OLEserver is shut down and the Terminate events

DevX - Software Development Resource

Raise Your OLE Server Errors

Don’t display errors from the OLE server. Instead, raise an error tothe client application. Use error numbers greater than vbObjectError +512 and less than vbObjectError + 5535. Values between vbObjectError

DevX - Software Development Resource

Use Backquotes Instead of Apostrophes

Often when using Transact-SQL, I want to capture comments from a user in a text box and send them tothe database. However, if the user types an apostrophe in the