添加组件bindingsource1
datagridview的Datasource属性添加到组件bindingsource1
添加类Student:
public class Student { public int Id { get; set; } public string Name { get; set; } }
bindingsource1的datasource属性绑定Student:
运行如图所示:
添加数据:
bindingSource1.Add(new Student() { Id = 1, Name = "alex" });