質問編集履歴

2

追記いたしました

2022/11/12 03:27

投稿

Erizabesu_Queen
Erizabesu_Queen

スコア1

test CHANGED
File without changes
test CHANGED
@@ -19,7 +19,8 @@
19
19
 
20
20
 
21
21
  以下コード:
22
+ ```
22
- ``` class Form1
23
+ class Form1
23
24
     //フィールド変数の定義
24
25
     public string abc = "{0,-10}{1,-20}";
25
26
  private List<string> id { get; set; } = new List<string>();

1

ご指摘いただいた通り```とフレームワークのバージョンなどを追記いたしました。

2022/11/12 03:14

投稿

Erizabesu_Queen
Erizabesu_Queen

スコア1

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,8 @@
1
- C#のlistについての質問です。vs2022を使っています。
1
+ C#のlistについての質問です。
2
+ 質問を投稿するのも初めてなので、至らない点が多々あると思いますがよろしくお願いします。
3
+
4
+ Windows 10 の Visual Studio 2022 で Windows Forms アプリをターゲットフレームワーク .NET Framework 4.8 で作っています
5
+ SQL Server のバージョン・エディションは、2022でlocalDBで作っております
2
6
 
3
7
  SQL Severから取得した値をフィールドのListに格納し、
4
8
  WindowsFormApplicationのclass Form1のlistboxに表示するようなシステム
@@ -15,7 +19,7 @@
15
19
 
16
20
 
17
21
  以下コード:
18
- class Form1
22
+ ``` class Form1
19
23
     //フィールド変数の定義
20
24
     public string abc = "{0,-10}{1,-20}";
21
25
  private List<string> id { get; set; } = new List<string>();
@@ -23,7 +27,7 @@
23
27
  private List<string> country { get; set; } = new List<string>();
24
28
  public List<string> Country { get => country; set => country=value;}
25
29
 
26
-    //
30
+    
27
31
  private void Form1_Load(object sender, EventArgs e)
28
32
  {
29
33
  listBox1.Items.Add(string.Format(abc, "id", "country"));
@@ -41,6 +45,8 @@
41
45
  }
42
46
 
43
47
  class Class1
48
+ internal class Class1:Form1
49
+ {
44
50
  public void Select()
45
51
  {
46
52
  //SQL Serverに接続処理
@@ -61,5 +67,5 @@
61
67
 
62
68
       SQL Serverに接続切断処理
63
69
     }
70
+ ```
64
71
 
65
-