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.
No comments:
Post a Comment