数据绑定您可以直接绑定datatable
但是无法绑定 combobox
- System.Data.DataTable dt = new System.Data.DataTable("Test");
- System.Data.DataRow dr = default(System.Data.DataRow);
- dt.Columns.Add("Series0");
- dt.Columns.Add("Series1");
- dr = dt.NewRow();
- dr[0] = 2;
- dr[1] = 1;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr[0] = 4;
- dr[1] = 2;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr[0] = 3;
- dr[1] = 4;
- gcSpreadSheet1.Sheets[0].AutoGenerateColumns = true;
- gcSpreadSheet1.Sheets[0].DataSource = dt;
- gcSpreadSheet1.Invalidate();
复制代码
|