Microsoft KB Archive/89040

= Microsoft Knowledge Base =

FastTips for Visual Basic for MS-DOS: Forms Q&A
Last reviewed: December 9, 1996

Article ID: Q89040

SUMMARY
Microsoft Technical Support Application Note (Text File) DV0600: FORMS QUESTIONS AND ANSWERS Revision Date: 8/92 No Disk Included The following information applies to Microsoft Visual Basic for MS-DOS version 1.0.


 * INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY   |
 * ACCOMPANY THIS DOCUMENT (collectively referred to as an           |
 * Application Note) IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY     |
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO   |
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A    |
 * PARTICULAR PURPOSE. The user assumes the entire risk as to the    |
 * accuracy and the use of this Application Note. This Application   |
 * Note may be copied and distributed subject to the following       |
 * conditions: 1) All text must be copied without modification and   |
 * all pages must be included; 2) If software is included, all files |
 * on the disk(s) must be copied without modification [the MS-DOS(R) |
 * utility DISKCOPY is appropriate for this purpose]; 3) All         |
 * components of this Application Note must be distributed together; |
 * and 4) This Application Note may not be distributed for profit.   |
 * Copyright 1992 Microsoft Corporation. All Rights Reserved.        |
 * Microsoft and MS-DOS are registered trademarks and Visual Basic   |
 * and Windows are trademarks of Microsoft Corporation.              |
 * and Windows are trademarks of Microsoft Corporation.              |

1. Q. When I run a PRINT or CLS (clear screen) command, it appears to be ignored. Why is this happening?

A. All output to a graphics screen should be done from a nonforms module (a .BAS file). This is because any PRINT or CLS command in a forms module defaults to the PRINT or CLS method, which makes it appear as if the PRINT or CLS command is ignored; however, the command is actually executed on your invisible form.

This behavior also affects printing to the desktop. Even if all forms in a program are invisible, the only way to print to the desktop is to call a subprogram within a nonforms module and then print from there.

2. Q. How can I simultaneously select multiple controls in the Form Designer?

A. Within the Form Designer (FD.EXE), you can simultaneously select multiple controls with the mouse. This allows you to change a     single property on multiple controls at one time. You cannot simultaneously select multiple controls with the keyboard. To     select multiple controls, hold down the SHIFT key and click each of the controls you want to select.

Chapters 2, 3, and 4 of the &quot;Programmer's Guide&quot; provide more information about using the Form Designer to create form-oriented programs.

3. Q. How do I put controls in a frame?

A. You can put controls in a frame using either a mouse or the keyboard; the procedure for doing so varies depending on which device you use.

To put controls in a frame with the mouse, use the following four-step procedure:

Step 1. Create a frame.

Step 2. Position and size the frame by clicking the sizing handles and the frame border. When you are finished sizing and positioning the frame, make sure the frame retains the focus. (The control with the sizing handles is the control that has the     focus.)

Step 3. On the toolbar, click the control type that you want to     place on the frame once. If you double-click the control type on     the toolbar, a control is created, but it is not in the frame.

Step 4. Once the control type you want is selected on the toolbar, click and hold down the left mouse button on the coordinate where you want the top-left corner of the new control to be located. While you continue to hold down the left mouse button, drag the mouse to where you want the bottom-right corner of the control to be located. Release the mouse button; the control should appear in the frame.

NOTE: When a control is inside a frame it is called a child of the frame.

To put controls in a frame using the keyboard, use the following five-step procedure:

Step 1. Create a frame using the Tools menu.

Step 2. Use the arrow keys to size the frame, then hold down the SHIFT key and use the arrow keys to position the frame.

Step 3. On the toolbar, choose the type of control you want to     put in the frame. (This creates a control in the form, not the     frame.)

Step 4. Make sure your new control has the focus. From the Edit menu, choose Cut.

Step 5. Press the TAB key until the frame you want has the focus. From

the Edit menu, choose Paste. The new control should be at the top- left

coordinate of the frame. You can then move the control to the position

you want. Chapter 4 of the &quot;Programmer's Guide&quot; provides more information on creating and using controls.

4. Q. How do I use a custom control?

A. To use a custom control and add it to an existing project, you must start VBDOS.EXE with the /l switch and the name of the Quick library that contains the custom control information. Once you are in the VBDOS environment, you can move to the Form Designer (FD.EXE); custom controls should now be available on the toolbar and on the Tools menu.

For more information about custom controls, please refer to     Chapter 19 of the &quot;Programmer's Guide.&quot; For owners of Microsoft Visual Basic for MS-DOS Professional Edition, information is     also available in Chapter 1 of the &quot;Professional Features&quot; guide. The distributor of your custom control should provide documentation about the use of that specific custom control.

5. Q. How can I create scrollable forms?

A. Scrollable forms cannot be created in Microsoft Visual Basic for MS-DOS. In Visual Basic for Windows, the most common method of     creating a scrolling form effect is to put controls on a picture box control and then change the top and left coordinates of the picture box control. In Visual Basic for MS-DOS, controls cannot have negative coordinates. Therefore, although it would be     possible to scroll down, it would not be possible to scroll up.

To work around this limitation in Visual Basic for MS-DOS, you can use multiple forms to represent pages and change the current form, rather than trying to include all the controls on a single form.

6. Q. During the translation process, the Form Translator (TRNSLATE.EXE) generates an error. What is causing this problem?

A. It is possible for the Form Translator to fail when you are converting a project. If the Form Translator fails, one of the following recommendations may correct the problem:

a. Make sure VB.EXE, VBDOS.EXE, and FT.EXE are on your path. The Form Translator prompts you for the path of VB.EXE, but it returns an error if VBDOS.EXE and FT.EXE are not found.

b. Make sure all your forms are saved in binary format. FT.EXE does not recognize text-mode forms and generates an        error if FT.EXE tries to convert a text-mode form.

c. Check the configuration of your default PIF file for COMMAND.COM. Because the Form Translator launches VBDOS.EXE, your MS-DOS session should have expanded and extended memory available. This increases the size of applications that the Form Translator can convert without error.

If all these options fail, you can use the Form Translator to     directly translate the forms of your project. Appendix G of the &quot;Programmer's Guide&quot; covers the conversion process from Visual Basic for Windows to Visual Basic for MS-DOS. Appendix H covers the conversion process from Visual Basic for MS-DOS to Visual Basic for Windows.