回答編集履歴

1

見直しキャンペーン中

2023/07/28 14:16

投稿

TN8001
TN8001

スコア9357

test CHANGED
@@ -1,53 +1,27 @@
1
1
  カラのリストを入れるのが原因っぼいですね。
2
-
3
-
4
2
 
5
3
  [DataGridViewで行にデータがあるのに、「インデックス -1に値がありません。」というエラーが発生する件の解決法 - modest violet](https://shin21.hatenablog.com/entry/2016/03/11/215257)
6
4
 
7
-
8
-
9
5
  [c# - Datagridview causing IndexOutOfRangeException when clicked upon - Stack Overflow](https://stackoverflow.com/questions/930069/datagridview-causing-indexoutofrangeexception-when-clicked-upon)
10
-
11
-
12
6
 
13
7
  [DataGridView IndexOutOfRangeException](https://social.msdn.microsoft.com/Forums/windows/en-US/e25c11ab-15e1-4927-b0ee-b9ace044414a/datagridview-indexoutofrangeexception?forum=winforms)
14
8
 
15
-
16
-
17
9
  こういう状態にはできないんでしょうか?
18
-
19
- ```C#
10
+ ```cs
20
-
21
11
  private void Form1_Shown(object sender, EventArgs e)
22
-
23
12
  {
24
-
25
13
  List<string> StringList1 = new List<string>();
26
-
27
14
  //dataGridView1.DataSource = StringList1;
28
15
 
29
-
30
-
31
16
  StringList1.Add("あいうえお");
32
-
33
17
  StringList1.Add("かきくけこ");
34
18
 
35
-
36
-
37
19
  dataGridView1.DataSource = StringList1;
38
-
39
20
  }
40
-
41
21
  ```
42
-
43
-
44
22
 
45
23
  ---
46
24
 
47
-
48
-
49
25
  「.NET5や6で直ってたりしないかな?」と、確認してみましたが変わらずでした^^;
50
-
51
26
  ざっとイシューも見てみましたが、見当たりませんでした。
52
-
53
27
  [Issues · dotnet/winforms](https://github.com/dotnet/winforms/issues)