Saturday, August 22, 2020

Difference Between Form1.Hide and Unload Me in VB 6

Contrast Between Form1.Hide and Unload Me in VB 6 Stow away and Unload are methods in Visual Basic 6-VB.NET does things another way. In VB6, you can see the distinction plainly by making a structure with a CommandButton part and a test explanation in the Click occasion. Note that these two explanations are totally unrelated, so just each can be tried in turn. Visual Basic 6 Unload Statement The Unload articulation expels the structure from memory. In most straightforward VB6 ventures, Form1 is the startup object so the program quits running as well. To demonstrate this, code the principal program with Unload. Private Sub Command1_Click()   Unload MeEnd Sub At the point when the catch is clicked in this task, the program stops. Visual Basic 6Hide Statement To demonstrate Hide, run this code in VB6 so the Hide technique for Form1 is executed. Private Sub Command1_Click()   Form1.HideEnd Sub Notice that Form1 vanishes from the screen, however the square End symbol on the Debug toolbar showsâ the venture is as yet dynamic. In the event that youre in question, the Windows Task Manager that is shown with CtrlAltDel shows the venture is still in Run mode. Speaking With a Hidden Form The Hide strategy just expels the structure from the screen. Nothing else changes. For instance, another procedure can at present speak with objects on the structure after the Hide strategy is called. Heres a program that exhibits that. Add another structure to the VB6 venture and afterward include a Timer componentâ and this code to Form1: Private Sub Command1_Click()   Form1.Hide   Form2.ShowEnd Sub Private Sub Timer1_Timer()   Form2.Hide   Form1.ShowEnd Sub In Form2, include a Command button control and this code: Private Sub Command1_Click()   Form1.Timer1.Interval 10000 10 seconds   Form1.Timer1.Enabled TrueEnd Sub At the point when you run the venture, tapping the catch on Form1 makes Form1 vanish and Form2 show up. In any case, tapping the catch on Form2 utilizes the Timer part on Form1 to hold up 10 seconds before making Form2 vanish and Form1 show up again despite the fact that Form1 isnt noticeable. Since the venture is as yet running, Form1 continues showing up like clockwork a method you may use to drive an associate deranged one day.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.