考慮我的代碼:設置DataGridView控件的DataSource。我做對了嗎? C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ClassTest
{
public partial class Form1 : Form
{
List<Employee> employeeList;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
employeeList = new List<Employee>();
employeeList.Add(new Employee("000001", "DELA CRUZ, JUAN T."));
employeeList.Add(new Employee("000002", "GOMEZ, MAR B."));
employeeList.Add(new Employee("000003", "RIVERA, ERWIN J."));
dataGridView1.DataSource = employeeList;
}
}
public class Employee
{
public Employee(string employeeNo, string name)
{
this.employeeNo = employeeNo;
this.name = name;
}
public string employeeNo;
public string name;
}
}
我沒有輸出這...
我有什麼錯?
難道你有一個錯誤或您的網格是空 – nemke 2010-11-08 00:17:18
爵士,只是沒有輸出.... – yonan2236 2010-11-08 00:21:27