Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2010 Help with delegates

$
0
0
Code:

Public Delegate Sub Show(ByVal str As String)

Public Shared Sub Main

Dim Shower As Show = Delegate.CreateDelegate(GetType(Show), GetType(MessageBox).GetMethod("Show", New Type() {GetType(String)}))
Shower.Invoke("Hello World!")

End Sub

Sorry for any mistakes in the code, I've been coding all in C# lately, and did this offhand. Could someone tell me why this doesn't return a MessageBox?

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>