Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, i have problem with invoke i have one class something like and inside another one
VB
Public Class Form1
...........
...........
...........
public class client

...........
 Private Sub finish(ByVal message As String)
            If Me.InvokeRequired Then
                Me.Invoke(New send(AddressOf finish), message)
            Else

                Form1.report(message + " Left server")
                Form1.delete(message)
            End If
        End Sub
    End Class


end class
.....
end class

and it gives me error ;Invoke; is not a member of ....
I don't understand what's wrong how I can use invoke in another class ??
Thank you
Posted
Updated 2-Oct-11 14:13pm
v2

1 solution

That's simply because you have not implemented a method called Invoke. I guess that is intentional as you seem to think your class client inherits Control which has a method called Invoke.
So you'll have to either implement Invoke yourself or inherit from Control[^].
The same goes for Form1.client.InvokeRequired
 
Share this answer
 
Comments
eljecto 3-Oct-11 6:16am    
so how do i do it ? because it doesnt seem to work for me or i dont get it . thanks
Simon Bang Terkildsen 4-Oct-11 2:34am    
Seems I were not notified by email of your comment, thus I did not notice it. But I see SA has provided you with a very thorough answer, I hope it helps you.
Sergey Alexandrovich Kryukov 3-Oct-11 19:35pm    
My 5. The question was later re-posted twice, I happened to answer in more detail here:
http://www.codeproject.com/Answers/263534/invoke-in-other-class#answer1.
--SA
Simon Bang Terkildsen 4-Oct-11 2:31am    
Thank you, SA
That's a very thorough answer you posted there, it got my 5 :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900