Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Raise Event in c#

$
0
0

Hi, I have this code from vb that call the method test from raising an event. I want to convert it in c# but the converted code from converter are not working, I search around and I have no luck of finding a simple one like in vb.

	Public Event Connected(ByVal msg As String)

    Sub test(ByVal msg As String) Handles Me.Connected
        TextBox1.Text = msg
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        RaiseEvent Connected("It works!")
    End Sub
How can I do this in c#? like have can I add a handle to the method test then if the event is raised the method will start. Thanks.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



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