修訂 | e87fe11505e8105dcf64183bcb7ed70d73f37f4d (tree) |
---|---|
時間 | 2012-10-30 07:21:55 |
作者 | konekoneko <jbh03215@hotm...> |
Commiter | konekoneko |
コンボボックスに値を入力して実行すると例外が起きるバグを修正した
@@ -27,10 +27,8 @@ namespace D2DBench | ||
27 | 27 | |
28 | 28 | private void button1_Click(object sender, EventArgs e) |
29 | 29 | { |
30 | - int maxcount = Int32.Parse(this.comboBox1.SelectedItem.ToString()); | |
31 | - int loopCountAtOneLoop = 50; | |
32 | - if(this.comboBox2.SelectedItem != null) | |
33 | - loopCountAtOneLoop = Int32.Parse(this.comboBox2.SelectedItem.ToString()); | |
30 | + int maxcount = GetIntFromComoboBox(this.comboBox1); | |
31 | + int loopCountAtOneLoop = GetIntFromComoboBox(this.comboBox2); | |
34 | 32 | |
35 | 33 | this.listView1.Items.Clear(); |
36 | 34 |
@@ -72,6 +70,14 @@ namespace D2DBench | ||
72 | 70 | benchFrom.Close(); |
73 | 71 | } |
74 | 72 | |
73 | + private int GetIntFromComoboBox(ComboBox box) | |
74 | + { | |
75 | + if (box.SelectedItem == null) | |
76 | + return int.Parse(box.Text); | |
77 | + else | |
78 | + return int.Parse(box.SelectedItem.ToString()); | |
79 | + } | |
80 | + | |
75 | 81 | private Form2 CreateBenchForm() |
76 | 82 | { |
77 | 83 | Form2 benchFrom = new Form2(); |