Visual Basic 2010でテキストボックスとコンボボックスを複数設置し コンボボックスの選択の組み合わせによって消すテキストボックスを決めたいと思っています。 初心者で下記のようなコードしか思いつかないのですが、これを簡略化できませんか? 例) コンボボックス1で一番目の項目を選択して、コンボボックス2で一番目の項目を選択した場合は テキストボックス1のテキストを消す コンボボックス1で一番上の項目を選択して、コンボボックス2で二番目の項目を選択した場合は テキストボックス2のテキストを消す みたいな感じです。 コード If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 1 Then TextBox1.Clear() ElseIf ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 2 Then TextBox2.Clear() ElseIf ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 3 Then TextBox3.Clear() ElseIf ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 4 Then TextBox4.Clear() End If わかりづらい文章で申し訳ないですが、わかる方、回答をお願いします。
↧