Dim B As New FmB Dim L As Integer L = 0 Dim M As Integer M = 1 Dim DgA As String = DataGridView1.CurrentRow.Cells("年齢").Value.ToString Dim DgB As String = DataGridView1.CurrentRow.Cells("名前").Value.ToString Dim DgA As String = DataGridView1.CurrentRow.Cells("住所").Value.ToString Dim DgB As String = DataGridView1.CurrentRow.Cells("性別").Value.ToString B.TextBox1.Text = DgA B.TextBox2.Text = DgB B.TextBox3.Text = DgC If DgD = "男性" Then B.Textbox4.text = L Else B.Textbox4.text = M End if B.show