Private Direction As New Dictionary(Of Object, Map.Dir)() Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load Direction.Add(lblMovingUp, Map.Dir.Up) Direction.Add(lblMovingDown, Map.Dir.Down) Direction.Add(lblMovingLeft, Map.Dir.Left) Direction.Add(lblMovingRight, Map.Dir.Right) End Sub Private Sub lblMoving_Click(sender As Object, e As EventArgs) Handles lblMovingUp.Click, lblMovingDown.Click, lblMovingLeft.Click, lblMovingRight.Click m.Map.Map_Move(Direction:=Direction(sender)) End Sub
Select Case True Case sender Is lblMovingUp dir = Map.Dir.Up Case sender Is lblMovingDown dir = Map.Dir.Down End Select ' https://github.com/dotnet/vblang/issues/568
m.Map.Map_Move(Direction:=sender.Tag) 'あるいは m.Map.Map_Move(Direction:=DirectCast(sender, Control).Tag)