VB.NET覚書

VB.NETの覚書
[個人メモ] [仕事メモ] [アイデア] [Ruby]
[TIPS] [対応表] [コメント書き方] [.NET Tips] [VB中学校] [VB.NET の入門サイト] [VB.NET コーディング標準 ] [VBレスキュー] [NonSoft]

2017-05-19

Event

http://rucio.a.la9.jp/main/dotnet/shokyu/standard49.htm

class


Public Class Class1

    Public Event Pop As EventHandler

    Public Sub DoAnything()

        RaiseEvent Pop(Me, New EventArgs)

    End Sub

End Class
Public Class Form1

    Dim WithEvents Tester1 As New Class1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Tester1.DoAnything()

    End Sub

    Private Sub Tester1_Pop(sender As Object, e As System.EventArgs) Handles Tester1.Pop
        MsgBox("Pop!")
    End Sub

End Class
トラックバック - http://sub.g.hatena.ne.jp/garyo/20170519