By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,238 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,238 IT Pros & Developers. It's quick & easy.

how can i execute a delegate on the thread that created the object ?

P: n/a

how can i execute a delegate on the thread that created the object ?
(the object is not control, but im looking somthing like the control.invoke
, but to my object)
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If I understand what you want, just use SomeObject.Invoke (etc.).

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 21 '05 #2

P: n/a
the way that I do this is via BeginInvoke on a delegate that points to
the method. the following snippets are from an article at
http://code.box.sk/newsread.php?newsid=717. Each snippet is from a
different location in the code, but the steps are as follows
0) declare a delegate (pointer) with a specific signature (think c/c++
here)
1) declare a variable of the delegate type
2) instantiate that variable
3) BeginInvoke

Delegate Sub UpdateWeatherSummaryResultsDelegate()
Private _updateWeatherSummaryResultsDelegate As
UpdateWeatherSummaryResultsDelegate

_updateWeatherSummaryResultsDelegate = New
UpdateWeatherSummaryResultsDelegate(AddressOf
UpdateWeatherSummaryResults)

Dim ar As IAsyncResult =
BeginInvoke(_updateWeatherSummaryResultsDelegate, Nothing)

Nov 21 '05 #3

P: n/a
Implement invoke method in your object.

Overloads Public Overridable Function Invoke( _
ByVal method As Delegate, _
ByVal args() As Object _
) As Object Implements ISynchronizeInvoke.Invoke
"roni" wrote:

how can i execute a delegate on the thread that created the object ?
(the object is not control, but im looking somthing like the control.invoke
, but to my object)

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.