0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

cscの作法 その491

Posted at

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

datatableを、DataGridViewで、表示せよ。

写真

image.png

サンプルコード


using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Reflection;
using System.Windows.Forms;
using System.Drawing;
using System.Data.OleDb;
using System.Data;

class form1: Form {
	form1() {
		Text = "DataTable";
		ClientSize = new Size(400, 300);
		DataTable dt = new DataTable();
		dt.Columns.Add("id", typeof(int));
		dt.Columns.Add("Name", typeof(string));
		dt.Columns.Add("Age", typeof(int));
		dt.Rows.Add(1, "太郎", 20);
		dt.Rows.Add(2, "次郎", 15);
		dt.Rows.Add(3, "三郎", 10);
		DataGridView gd0 = new DataGridView();
		gd0.Location = new Point(20, 20);
		gd0.Size = new Size(350, 250);
		gd0.DataSource = dt;
		Controls.AddRange(new Control[] {
			gd0
		});
	}
	[STAThread]
	public static void Main() {
		Application.Run(new form1());
	}
}




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?