
Use the Len ( ) Function to Check for Empty Strings
Use the Len() function to check for an empty string rather than the”” or “=” operators. For instance: If sName “” Then … End If This is functionally the same,

Use the Len() function to check for an empty string rather than the”” or “=” operators. For instance: If sName “” Then … End If This is functionally the same,

Every control has an implicit “value” property. For textboxes it is the Text property. For Labels it is Caption: lblZip.Caption = “Zip Code” You do not need to reference this

If you have a large app, consider breaking it down into smaller apps.Use one main EXE that calls the others and DDE to provide communication.When a sub-app opens, open a

There is a very simple trick you can perform with labels and text boxesthat will help users who like to use the keyboard instead of the mouse.Notice the underlines in

To set a form to be always on top, use the subroutine listed here.Pass it the hWnd property of the form you want to float. The OnTop parameteris used to

When you’re using OLE or the JET database engine, you’ll need to loadSHARE on your system and all systems you deliver your app to. In the lattercase, you are guaranteed

If an API call is not achieving the desired or expected effects, tryplacing ByVal in front of parameters. Likely ones to cause trouble arestrings and anything declared “As Any.” The

Attributes such as the foreground color, background color, and fontsof cells in Sheridan’s DataGrid can easily be changed by setting RowCellxxxxproperties such as RowCellForeColor, RowCellBackColor, RowCellItalic, andso on from within

When you use the Declare statement, approximately 11 bytes are addedto the size of your EXE. The name of the function and library where itresides are also stored in the

There may be situations in which you want to display text that theuser cannot edit, but a label control doesn’t quite fit the bill. Whatyou need is a read-only text

If you need to fire a command button’s Click event, you can set theValue property to True: cmdAdd.Value = True The real benefit of this is that you can call

You can set .SelectedColor and .FillColor in the Mh3DList to be thesame, and use .ListPicture and .ListPictureSel properties to indicate selected/deselectedstates. Related Posts Cross-platform Development in C# with XamarinCyber Security

The Outline control might at first seem very usable. Well, it isn’t.Apart from the arcane interface, it’s almost guaranteed to blow up yourapp if it’s running on a “nonstandard” video

Programmer’s of all skill levels often make errors when using Booleanlogic. This statement might not evaluate the way you think it should: IF (SomeNumber AND 16) OR _ (SomeOtherNumber 0)

Always use Option Explicit: it draws immediate attention to variabletypos. Always use Save As Text: files are less easily corrupted, more easilyrecovered, and editable by a text editor other than

When you change the row in the data control that a Sheridan DataGridis bound to, the DataGrid will also reposition its current row. To avoidthis, use the Clone method to

If the DataGrid is bound to a VB data control, you need to set theRecordSource property of the data control to “” (null string)and then use the Refresh method: Sub

If a VBX is acting erratically, make sure you are using the most currentversion of the VBX on your system (and make sure to put it into your user’sWindows/System directory

The SBCEasy custom control that comes with Desaware’s SpyWorks-VB canbe used to update a status bar whenever the mouse moves over any controlor form in your application. All you need

Many features of SBCEasy (a tool that comes with Desaware’s SpyWorks-VB)work only on its container, and because it cannot be placed on a MDI Parentform, the MenuSelect event does not

Be sure to remove functions or procedures that you are no longer using.If you delete a control, be sure to remove the event procedures that weretied to that control. Related

There are two ways to save changes before exiting a form. One is toinvoke the Update method on the data control the DataGrid is bound to fromwithin the QueryUnload event

Setting the ClipControls property to False significantly reduces thetime it takes forms to paint. The default is True, so you’ll need to changeit to False. If you’re using graphics methods,

Keep control and form names as short as possible. Such names are keptin the EXE file. Variable names, however, are not kept in the EXE. Related Posts Greece sees significant

Grids provide a nice way to present certain types of spreadsheet information.Unfortunately, the grid in VB does not allow editing. With just a littlebit of code you can simulate editing

Using the AutoSave feature in the VBAssist Options box automaticallysaves changes made to your project after a defined time interval. To temporarily bypass VBAssist’s Control Lock feature, hold down theCtrl

To toggle a variable between True and False, use the Not operator insteadof an If statement. Use the Not operator on those variables you have explicitlyset with the True or

To quickly set tab stops in list boxes, use the SendMessage API call.The units used are called Dialog Base Units, which average out to aboutfour per character. Some experimentation is

Because the picture control has more overhead than the image control,it’s best to use the image control when you need to display a graphic.Use the picture control when you need

If you need to reference every control on a form, using the Controlscollection will be faster than referencing every control directly. Forexample, if you have four command buttons on a