Affected : Form , Forms collection , MDIForm
Purpose : The Hide method makes an active and visible form disappear from the screen and is the same as setting the form's visible property to False ( 0 ) .
Syntax :
[ form . ] Hind
Private Sub Form1_Load ( )
Form2.Hide
Form2.BackColor = RGM ( 0 , 255 , 0 )
Form2.ForeColor = RGB ( 0 , 0 , 255 )
MsgBox " Press OK to see form2 "
Form2.Show
End Sub
The Hide method reduces clutter by removing a form from the screen without removing it from memory . Any forms not initially needed can be loaded and hidden until desired. The Show method displays a hidden form onscreen. Hidden forms take a little more time to load at program startup but can then be displayed very quickly.
Show Method :
The Hide method shares an inverse relationship with the Show method. Hide removes the form from sight and show restores it. In the sample syntax , the two methods work together to make a form invisible while its color change.This technique also can be used for a warning bialog box that displays context-sensitive messages. if the form is not loaded , the show method loads it into memory.
Visible Property :
When the Hide method makes a form invisible , the Visible property of the form becomes False. The difference between using the Hide method and directly changing the setting of the visible property lies in the types of objects affected . the hide method can only be used on a form .In contrast , the visible property can be used on any of the objects in visual basic.
Arvind Nahar
Sunday, November 21, 2010
Visual Basic Forms Method : Hide
Saturday, November 20, 2010
Visual Basic Forms Property : ControlBox
Affected : Form
Purpose : The ControlBox property governs whether a control box appears in the top-right corner of a form. This property is read -only at runtime.
Syntax :
[ form . ] ControlBox
Argument of the ControlBox Property
form : Name property of the form ( if no name is specified, references the current form's controlbox property )
Public Sub SetColor ( FormName As Form )
If FormName.ControlBox = 0 Then
FormName.BackColor = RGB ( 192, 192 192 )
Else
FormName.BackColor = RGB ( 0 , 128 , 0 )
End If
End Sub
Purpose : The ControlBox property governs whether a control box appears in the top-right corner of a form. This property is read -only at runtime.
Syntax :
[ form . ] ControlBox
Argument of the ControlBox Property
form : Name property of the form ( if no name is specified, references the current form's controlbox property )
Public Sub SetColor ( FormName As Form )
If FormName.ControlBox = 0 Then
FormName.BackColor = RGB ( 192, 192 192 )
Else
FormName.BackColor = RGB ( 0 , 128 , 0 )
End If
End Sub
Visual Basic Forms Property : AutoShowChildren
Purpose : The AutoShowChildren property indicates whether an MDI child form can be hidden when it is loaded. By using this property, you can load but not show an MDI child form.
Syntax :
Name.AutoShowChildren [ = Boolean% ]
Arguments of the AutoShowChildren Property
Argument : Description
boolean% : An optional Boolean expression that specifies whether MDI child forms are automatically visible. if not included defaults to True.
Name : Name property of MDIForm
Private Sub Form_Load
MDIForm1.AutoShowChildren = True
End Sub
Syntax :
Name.AutoShowChildren [ = Boolean% ]
Arguments of the AutoShowChildren Property
Argument : Description
boolean% : An optional Boolean expression that specifies whether MDI child forms are automatically visible. if not included defaults to True.
Name : Name property of MDIForm
Private Sub Form_Load
MDIForm1.AutoShowChildren = True
End Sub
Visual Basic Forms Method : Arrange
Purpose : Use the Arrange method on an MDI form to arrange all MDIchild forms contained within the MDI form.
Syntax :
[ Name ] . Arrange Setting%
Arguments of the Arrange Method
Arguments : Decsription
Name : Name property of the MDI form
setting% : A value that specifies how to arrange the windows or icons
Private Sub menuWindow_Click ( Index As Integer )
Select Case Index
Case 0 : MDIForm.Arrange vbCascade
Case 1 : MDIForm.Arrange vbTileHorizontal
Case 2 : MDIForm.Arrange vbTitleVertical
Case 3 : MDIForm.Arrange vbArrangeIcons
End Select
End Sub
Syntax :
[ Name ] . Arrange Setting%
Arguments of the Arrange Method
Arguments : Decsription
Name : Name property of the MDI form
setting% : A value that specifies how to arrange the windows or icons
Private Sub menuWindow_Click ( Index As Integer )
Select Case Index
Case 0 : MDIForm.Arrange vbCascade
Case 1 : MDIForm.Arrange vbTileHorizontal
Case 2 : MDIForm.Arrange vbTitleVertical
Case 3 : MDIForm.Arrange vbArrangeIcons
End Select
End Sub
Visual Basic Forms Event : Activate
Purpose : The Activate event fires when a form, MDI form , or data report becomes the active window in an application.
Syntax :
Sub Form_Activate ( )
Sub MDIForm_Activate ( )
Sub DataReport_Activate ( )
An object can become active by a user action such as clicking the object or by using the Show or SetFocus method in code. The activate event can occur only when an object is visible . A form loaded with the Load statement , for example , isn't visible unless you use the Show method or set the form's Visible property to True. The Activate event occurs only when moving the focus within an application. Moving the focus to or from an object in another application doesn't trigger the event.
The Deactivate Event :
the Deactivate and Activate events have an inverse relationship. Whereas the Activate eent occurs when a form becomes active , the Deactivate event occurs when a form is no longer active. The Deactivate event occurs only when moving the focus within an application. Moving the focus to or from an object in another application doesn't trigger either event. The Deactivate event doesn't occur when unloading an object.
The LostFocus event occurs before the Deactivate event.
Syntax :
Sub Form_Activate ( )
Sub MDIForm_Activate ( )
Sub DataReport_Activate ( )
An object can become active by a user action such as clicking the object or by using the Show or SetFocus method in code. The activate event can occur only when an object is visible . A form loaded with the Load statement , for example , isn't visible unless you use the Show method or set the form's Visible property to True. The Activate event occurs only when moving the focus within an application. Moving the focus to or from an object in another application doesn't trigger the event.
The Deactivate Event :
the Deactivate and Activate events have an inverse relationship. Whereas the Activate eent occurs when a form becomes active , the Deactivate event occurs when a form is no longer active. The Deactivate event occurs only when moving the focus within an application. Moving the focus to or from an object in another application doesn't trigger either event. The Deactivate event doesn't occur when unloading an object.
The LostFocus event occurs before the Deactivate event.
Subscribe to:
Comments (Atom)