| |

VerySource

 Forgot password?
 Register
Search
View: 724|Reply: 6

How to close all other forms by clicking the button in one form? ? ?

[Copy link]

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-7 21:30:01
| Show all posts |Read mode
After running the program, multiple forms are opened. I want to close all the forms by clicking the button in one of them. How do you master this function?
Thanks in advance, ^ _ ^
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-26 22:00:02
| Show all posts
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-26 22:15:01
| Show all posts
end process
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-27 12:15:01
| Show all posts
If your control form is A_form
Your accused form is B_form

Write in the charged form
    Dim formtemp1 As A_Form
    Public Function Instance (ByVal frm As A_Form)
        formtemp = frm
    End Function

Write in the control form

    Dim tempfrm As New B_Form
    tempfrm.Instance (Me)

    tempfrm.close ‘This sentence closes the controlled window

Similarly, you can do other things. If assigned, update something.
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-27 13:30:01
| Show all posts
In the button event code:
Application.Exit ();
return;
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-27 14:15:02
| Show all posts
Write off a 1
Repost

If your control form is A_form
Your accused form is B_form

Write in the charged form
    Dim formtemp1 As A_Form
    Public Function Instance (ByVal frm As A_Form)
        formtemp1 = frm ’Wrong one in this sentence 1
    End Function

Write in the control form

    Dim tempfrm As New B_Form
    tempfrm.Instance (Me)

    tempfrm.close ‘This sentence closes the controlled window

Similarly, you can do other things. If assigned, update something.
Reply

Use magic Report

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-6-10 13:30:01
| Show all posts
Haha, thank you friends, the problem is solved.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list