Difference between revisions of "The Basics of VB6"
From Free Knowledge Base- The DUCK Project: information for everyone
(New page: These notes can be organized later. === Open a Form From Another Form === Open the form called frmCompanies frmCompanies.Show Open it so that the parent form cannot be clicked. To s...) |
m (→From Dimensions and Twip Units) |
||
Line 25: | Line 25: | ||
The default unit is the twip, which is 1/1440 of an inch for height, width, top, and left. | The default unit is the twip, which is 1/1440 of an inch for height, width, top, and left. | ||
+ | |||
+ | There are 15 twips per pixel. | ||
Pixels to Twip: | Pixels to Twip: |
Revision as of 10:14, 21 September 2007
These notes can be organized later.
Open a Form From Another Form
Open the form called frmCompanies
frmCompanies.Show
Open it so that the parent form cannot be clicked. To suspend execution of the first form until after the second form is done with, add the keyword constant vbModal as an argument to the Show method.
frmCompanies.Show vbModal
The Hide method of a form removes the form from the screen (makes it invisible), but the form still remains in memory.
frmCompanies.Hide Me.Hide Hide
You can load a form in memory and not display it.
Load frmCompanies
Unload form from memory (which also closes it)
Unload Me
Example
Private Sub Form_Unload(Cancel As Integer) If MsgBox("Are you sure you want to quit?", vbYesNo + vbQuestion, "Unload Test") = vbNo Then Cancel = 1 End If End Sub
From Dimensions and Twip Units
The default unit is the twip, which is 1/1440 of an inch for height, width, top, and left.
There are 15 twips per pixel.
Pixels to Twip:
W = W * Screen.TwipsPerPixelX H = H * Screen.TwipsPerPixelY
Twips to Pixel:
W = W / Screen.TwipsPerPixelX H = H / Screen.TwipsPerPixelY