Public Class Form1 Dim card1 As String Dim card2 As String Dim card3 As String Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click 'ここではシャッフルはテーマでないので扱いませんが、 'シャッフルしても正常に表示・判定できます。 card1 = "スペード1" card2 = "ダイヤ5" card3 = "クラブ9" PictureBox1.Image = GetImage(card1) PictureBox2.Image = GetImage(card2) PictureBox3.Image = GetImage(card3) End Sub ''' <summary>トランプの画像を取得します。</summary> Private Function GetImage(card As String) As Image Dim fileName As String = "" Select Case card Case "スペード1" fileName = "s01.png" Case "ダイヤ5" fileName = "d05.png" Case "クラブ9" fileName = "c09.png" End Select Dim folder As String = Application.StartupPath & "\image" Return Image.FromFile(folder & "\" & fileName) End Function Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click MsgBox(card1) End Sub Private Sub PictureBox2_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox2.Click MsgBox(card2) End Sub Private Sub PictureBox3_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox3.Click MsgBox(card3) End Sub End Class