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.
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.
Wednesday, November 3, 2010
Visual Basic Operating Environment Function : Shell
Purpose : The Shell function runs a specified .EXE , .COM , .BAT OR .PIF program.
Syntax :
Shell ( program-name$ [ , mode% ] )
A% = Shell ( " WINWORD.EXE " )
B% = Shell ( " C : \ WORD \ WINWORD.EXE " , 3 )
The Shell function loads an executable file into the windows environment and returns the task ID number that Windows assigns to each tunning program.
the first example loads and runs the program file WINWORD.EXE . it assumes that the file is in the default directory or in a directory specified by the path statement. because the mode is not specified , it uses the default mode of 2 ( minimized with focus )
Shell function constants of then mode% parameter
consant : value : Description
vbHide : 0 : Hides window with focus
vbNormalFocus : 1 : give window focus and restores ti to its original size and position.
vbMinimizedFocus : 2 : Minimizes and gives window focus
vbMaximizedFocus : 3 : Mazimizes and gives window focus
vbNormalNoFocus : 4 : Restores window to its original size and position with-out focus
vbMinimizedNoFocus : 6 : Minimizes window without focus.
Syntax :
Shell ( program-name$ [ , mode% ] )
A% = Shell ( " WINWORD.EXE " )
B% = Shell ( " C : \ WORD \ WINWORD.EXE " , 3 )
The Shell function loads an executable file into the windows environment and returns the task ID number that Windows assigns to each tunning program.
the first example loads and runs the program file WINWORD.EXE . it assumes that the file is in the default directory or in a directory specified by the path statement. because the mode is not specified , it uses the default mode of 2 ( minimized with focus )
Shell function constants of then mode% parameter
consant : value : Description
vbHide : 0 : Hides window with focus
vbNormalFocus : 1 : give window focus and restores ti to its original size and position.
vbMinimizedFocus : 2 : Minimizes and gives window focus
vbMaximizedFocus : 3 : Mazimizes and gives window focus
vbNormalNoFocus : 4 : Restores window to its original size and position with-out focus
vbMinimizedNoFocus : 6 : Minimizes window without focus.
Labels:
Function,
Operating Environment,
Shell,
Visual Basic
Visual Basic Operating Environment Function : Environ, Environ$
Purpose : The Environ and Environ$ function return setting from the operating system's environment table.
Syntax :
Environ ( { entry_name$ | entry-position% } )
Environ$ ( { entry_name$ | entry-position% } )
A$ Environ ( " path " )
A$ Environ ( 1 )
DOS maintains a table of values called environment variables. values in the environment table typically store information abut such things as the current drive and path, the location of the command processor, or special settings needed y various programs.
The Environ and Environ$ functions allow the program to read the current setting of the operating system's environment table . Entries in the environment table are set by using the DOS command syntax SET ENTRY_NAME = ENTRY_VALUE. see a DOS reference manual for more information on the SET command. Environ allows you to specify either the name or position of the entry to be retrieved.
Syntax :
Environ ( { entry_name$ | entry-position% } )
Environ$ ( { entry_name$ | entry-position% } )
A$ Environ ( " path " )
A$ Environ ( 1 )
DOS maintains a table of values called environment variables. values in the environment table typically store information abut such things as the current drive and path, the location of the command processor, or special settings needed y various programs.
The Environ and Environ$ functions allow the program to read the current setting of the operating system's environment table . Entries in the environment table are set by using the DOS command syntax SET ENTRY_NAME = ENTRY_VALUE. see a DOS reference manual for more information on the SET command. Environ allows you to specify either the name or position of the entry to be retrieved.
Labels:
Environ,
Environ$,
Function,
Operating Environment,
Visual Basic
Visual Basic Operating Environment Function : Command
Purpose : The Command and command$ function return a variant or string that contains any Command-line Parameters used when Visual Basic or the Visual Basic environment Program was started.
Syntax :
Command
Command$
Command
Command$
Params$ = Command$
in this example stores command-line parameters for the current program into the string Params$. these functions return any test that followed the CMD parameter on the command line. the string returned by the visual basic environment can be modified by choosing properties from the project menu. When used with a Visual Basic program , Command$ returns any text that followed the executable filename on the command line.
Labels:
Command,
Command$,
Function,
Operating Environment,
Visual Basic
Monday, November 1, 2010
Visual Basic Operating Environment Statement : Beep
Purpose : The Beep statement causes the computer's speaker to produce a short tone.
Syntax :
Beep
Beep
If ErrorNumber% > 0 Then Beep
The example beeps the speaker if the variable ErrorNumber is set. The Beep statement causes the computer to send a short tone to the speaker. you can control neither the tone not the duration; however, issuing several beep command consecutively can create the effect of a longer beep.
The example beeps the speaker if the variable ErrorNumber is set. The Beep statement causes the computer to send a short tone to the speaker. you can control neither the tone not the duration; however, issuing several beep command consecutively can create the effect of a longer beep.
Labels:
Beep,
Operating Environment,
Statement,
Visual Basic
Visual Basic Operating Environment Statement : AppActivate
Purpose : The AppActivate statement activates a running Windows program and gives it the Current focus. It does not change the window State property (minimized or maximized) Of the program.
Syntax :
AppActivate ProgramTitle$ [, wait]
AppActivate ProgramTitle$ [, wait]
AppActivate “ paintbrush - ( Untitled ) “
AppActivate “ paintbrush-( untitled )” , True
AppActivate “ paintbrush-( untitled )” , True
The first example gives the paintbrush application the focus, assuming that it is already running and has no file loaded.
The second example works the same as the first example , except that it waits until the calling application has the focus.
The second example works the same as the first example , except that it waits until the calling application has the focus.
Labels:
AppActivate,
Operating Environment,
Statement,
Visual Basic
Subscribe to:
Comments (Atom)