Intermediate Page One
Capitalise First Letters
One of my favourite functions is StrConv(). You can use it to capitalise the first letter of a group of words, ideal for properly formatting names. You use it like this:
MsgBox StrConv("jonathan plaza", vbProperCase)
This function will return 'Jonathan Plaza'. But be wary of names such as McDonald, O'Brien and other anomalies it won't handle those properly!
-- Jonathan Plaza, living in VB-World ;)
Sending Keystrokes to Other Programs
Here's a nice little trick to try. Open up WordPad, which comes with Windows 95/98 (in the Accessories menu). Notice that it's title is "Document WordPad".
Now run this code in Visual Basic:
AppActivate ("Document - WordPad")SendKeys ("Hello from Visual Basic!")
The AppActivate function brings the application with that title to the 'front' of your screen. The SendKeys function just acts as though you were typing the string you pass it so in other words, 'Hello from Visual Basic!' gets tapped into WordPad.
For more information on the various SendKeys commands, look the method up in Visual Basic help.
-- Adam "AppActivate" Alanson.
Setting Tab Orders
When you press tab on a form, the focus moves from one control to the next. To change the order of this, you alter the TabIndex control of each individual control.
Here's a great tip for getting through all your controls with minimal effort start with the very last control you want to have the focus and work backwards, setting the TabIndex property of each to 0.
You'll find that Visual Basic automatically renumbers each control for you and all your horrid tab problems are solved!
-- Paul Simpson, Manchester.
Use the Clipboard
You can easily implement clipboard functionality in your application using the inherent Clipboard object. Here's a simple example of its usage:
Clipboard.SetText("My Text Clipboard Text")MsgBox Clipboard.GetText
Simple, yes - but powerful!
-- The Mysterious AppMan, Hotmail.
Page 2 of 4