Quick Tips

  This section is designed to give you super-quick insights as to how to improve the way you use RB. Unlike the Tips section, these tips are super-short, and don't come with lots of screenshots and a tutorial. And, in the spirit of the last issue, I've included 12 of them.

1

  Don't create folders in your project window unless you have a lot of classes/windows/modules. The organization they provide in a small project isn't worth it.

2

  Always save after using the File Types dialog. This is known to cause crashes when you run the program on some machines.

3

  Don't use Select Case with strings. It still uses the old style "=" comparisons, which are about 150 times slower than the comparisons used in if statements. Select Case works fine with numbers though...

4

  Always remember to setup default and cancel buttons for dialog boxes. This makes them much more efficient for the user to work with.

5

  If you're getting NilObjectExceptions when you try to edit/access graphics, set up an If statement around the code to see if the picture you're accessing is nil.

6

  Always keep a pencil and a stack of paper with you when you're writing a program. Sometimes, you've just got to write something out to see how it works. And as a bonus, paper isn't susceptible to system crashes!

7

  Instead of writing Open and New code for a window in your program, just write open and new code in an Application subclass, and call App.NewDocument, and App.OpenDocument.

8

  If you get NilObjectExceptions from a graphics object, even though the picture containing it isn't nil, it's probably because the picture is from the clipboard, or the project window. These pictures exist, but don't have graphics. To edit them, make a new picture, and draw the old picture into it.


9

 When working with doubles, use the Format instead of Str for much better precision.

10

  Hold down shift while you resize a control to restrict its height or width to their previous values.

11

 To clear the focus from all controls in your window, just call the ClearFocus method.

12

  If you check both the LockLeft and LockRight properties for a control, it will automatically change size when you resize the window while the program is running. This is useful for simple windows, but not for more complicated ones. The same goes for LockTop and LockBottom.