August 8, 1997

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.

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

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.

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.

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 =