| |

VerySource

 Forgot password?
 Register
Search
View: 664|Reply: 4

How to trigger events in the main thread in a child thread?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-8 21:30:02
| Show all posts |Read mode
Public Class Down
    Public Sub DownRun ()
    s = xxx
    I want to trigger the XinXi event in MAIN and pass the parameter S
    end sub
end class


public class main
    Event XinXi (ByVal sender As Object, ByVal s As String)
private sub a
    dim r as new down
    Dim t As New System.Threading.Thread (AddressOf r.DownRun)
    t.Start ()
end sub
Reply

Use magic Report

0

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-31 21:00:02
| Show all posts
A method to call back the main thread, RaiseEvent Xinxi
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-6-2 00:00:01
| Show all posts
But Xinxi is not in the down category
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-5 11:15:01
| Show all posts
to but Xinxi is not in the down category

When the down class object is initialized, the function xinxi is passed in as a delegate, so that it can be called in the down class.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-5 12:30:03
| Show all posts
Delegate call MSDN search delegate
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