Monday, June 8, 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 strategies in Visual Basic 6-VB.NET does things any other way. In VB6, you can see the distinction obviously by making a structure with a CommandButton part and a test proclamation in the Click occasion. Note that these two proclamations are totally unrelated, so just each can be tried in turn. Visual Basic 6 Unload Statement The Unload proclamation 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 undertaking, 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 technique just expels the structure from the screen. Nothing else changes. For instance, another procedure can even now speak with objects on the structure after the Hide technique is called. Heres a program that exhibits that. Add another structure to the VB6 task 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 undertaking, tapping the catch on Form1 makes Form1 vanish and Form2 show up. In any case, tapping the catch on Form2 utilizes the Timer segment on Form1 to hold up 10 seconds before making Form2 vanish and Form1 show up again despite the fact that Form1 isnt obvious. Since the undertaking is as yet running, Form1 continues showing up like clockwork a strategy you may use to drive a collaborator deranged one day.

No comments:

Post a Comment

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