DataGridView控件可以通过以下方式绑定数据:
dataGridView.DataSource = dataTable;
dataGridView.Rows.Add("John", "Doe");
dataGridView.Rows.Add();
dataGridView.Rows[0].Cells[0].Value = "John";
dataGridView.Rows[0].Cells[1].Value = "Doe";
public class MyDataSource : IDataSource
{
// 实现接口方法...
}
MyDataSource dataSource = new MyDataSource();
dataGridView.DataSource = dataSource;