devxlogo

August 8, 1997

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

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

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.

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.

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

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.

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

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 =