The Latest

DevX - Software Development Resource

Use the Shortest Variables

Use the shortest data type you can for variables. If you’re going tobe counting in a loop from 1 to 10, for instance, use an Integer not aDouble. Related Posts

DevX - Software Development Resource

Using the MH3D Calendar Control for Date Math

One of the great unsung heroes in MicroHelp’s VBTools is the Mh3dCalendarcontrol. Place a hidden calendar control on one of your main forms. Withthe .Day, .Month, .Year, and .DateFormat properties,

DevX - Software Development Resource

Using LostFocus Events with Command Button Properties

If you’re using LostFocus events but would also like to set the Defaultor Cancel properties for command buttons, you’ll run into a confusing situation.Those properties trigger the Click event when

DevX - Software Development Resource

Sorting Data Within a Datagrid

Data is sorted by using the “ORDER BY” clause in a SQL statementand then assigning the SQL statement to the RecordSource property of thedata control that the DataGrid is bound

DevX - Software Development Resource

Keyboard Shortcuts

Yes, these shortcuts are in the manual, somewhere, but it’s helpfulto brush up on them. Using keystrokes is usually faster than using themouse to do the same thing. Photocopy these

DevX - Software Development Resource

Build Your Own Floating Toolbar

Ever wanted a floating toolbar? To make one form “owned”by another, all it takes is a simple API call. Afterwards, the owned formwill float above the form that owns it,

DevX - Software Development Resource

Change the Container of a Control

I use bounded text boxes within the picture control but they act asif they belong to the form. Here’s how to make them act as if they belongto a container

DevX - Software Development Resource

Use Smaller Graphics to Save Resources

Larger bitmaps used for .ListPicture/ListPictureSel properties in Mh3DListconsume proportionally larger amounts of resources. Also, avoid using 256-colorbitmaps in controls–they too consume more resources. Related Posts Have Courage in Extreme ProgrammingFrance

DevX - Software Development Resource

Giving Forms a 3-D Look

It’s not widely known that you can use CTL3D.DLL (or CTL3DV2.DLL) togive your VB forms the same 3-D look of Microsoft’s Office suite of applications.First, your app must register with

DevX - Software Development Resource

Indenting Code Blocks

You can highlight a block of text in the code window and press theTab key to indent the block or Alt-Tab to unindent it. Related Posts Google Open Sources AI

DevX - Software Development Resource

Troubleshooting Custom DLLs in VB

If you’re getting GPFs and you aren’t sure if the cause is your customDLL or VB, write a BAS file stub that simulates your DLL. If the GPFs persist,its not

DevX - Software Development Resource

Disabling All Controls on a Form

If you ever need to disable all the controls on a form you can loopthrough the control array and set each Enabled property to Falsewith this code: Sub cmdArray_Click ()

DevX - Software Development Resource

Finding a String in a Combo Box

The CBFindString()procedure searches for a string in a combo box byusing the SendMessage() API function to find a specific entry in the list.This is much more efficient than searching using

DevX - Software Development Resource

Run Multiple Copies of VB

For debugging or whenever you want to copy code from one project toanother, it would be very easy if you could have two instances of VB runningat the same time.

DevX - Software Development Resource

Break up Large Apps

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

DevX - Software Development Resource

Access Keys with Labels

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

DevX - Software Development Resource

Make Forms Stay on Top

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

DevX - Software Development Resource

Use VShare.386

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

DevX - Software Development Resource

Use ByVal When API Calls Cause Problems

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

DevX - Software Development Resource

Changing Colors and Fonts of DataGrid Cells

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

DevX - Software Development Resource

Get Rid of Unused Declare Statements

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

DevX - Software Development Resource

Call the Click Event

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

DevX - Software Development Resource

Indicating Selected/Deselected States for Items

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

DevX - Software Development Resource

Avoid the Outline Control

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

DevX - Software Development Resource

Tips on Using Boolean Logic

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)

DevX - Software Development Resource

Always Use These

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