Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim aa As String = $"*{TextBox2.Text}{TextBox3.Text}{TextBox3.Text}{TextBox4.Text}{TextBox5.Text}*" If ComboBox1.SelectedItem = Nothing Then Label1.Text = "選択されていません。" ElseIf ComboBox1.SelectedItem = 1 Then Dim a As Object = PictureBox1 ElseIf ComboBox1.SelectedItem = 2 Then Dim a As Object = PictureBox2 ElseIf ComboBox1.SelectedItem = 3 Then Dim a As Object = PictureBox3 ElseIf ComboBox1.SelectedItem = 4 Then Dim a As Object = PictureBox4 End If If TextBox1.TextLength > 0 Then Dim maxheight As Integer = 40 Dim barcode39 As Code39BarcodeDraw = BarcodeDrawFactory.Code39WithChecksum Label1.Text = aa Dim img As Image = barcode39.Draw(aa, maxheight, 2) a.Image = img End If Catch aex As Exception MsgBox("例外が発生しました。" & vbNewLine & aex.Message) End Try End Sub