Last post Jan 31, 2018 06:35 AM by Cathy Zou
Jan 29, 2018 07:37 PM|uid390594|LINK
how do i do this:
Dim t As Action = Sub()
put a method in an object, and then run it.
Jan 29, 2018 08:04 PM|A2H|LINK
You can make use of
Action Delegate to achieve your requirement like below
First Create a method like below in your page
Public Sub DisplayMessage()
now assign this method to Delegate and then call Run method in task to execute it
Dim t As Action = New Action(AddressOf DisplayMessage)
'Execute the method
Jan 29, 2018 09:00 PM|uid390594|LINK
riiiight i forgot the new word..
as new action(sub()
Jan 29, 2018 09:05 PM|uid390594|LINK
how to run it in the background and not wait for exit?
Jan 31, 2018 06:35 AM|Cathy Zou|LINK
As a2h suggested, you could use Action delegate. Action delegate didn’t return a value.
The usage of it as below:
protected void Page_Load(object sender, EventArgs e)
Action<string> t = ShowWindowsMessage;
// Execute the method
void ShowWindowsMessage(string message)
TextBox1.Text = message;
For more details about this, please refer to the links below: