private void Form1_Load(object sender, System.EventArgs e)
{
//連結時の列自動生成を無効とします
fpSpread1.ActiveSheet.AutoGenerateColumns = false;
//データセットを手動で作成します
DataTable DT = new DataTable();
DataSet DS = new DataSet();
DT = DS.Tables.Add("SampleTable");
DT.Columns.AddRange(new DataColumn[] {
new DataColumn("ID", Type.GetType("System.Int32")),
new DataColumn("Text", Type.GetType("System.String")),
new DataColumn("Check", Type.GetType("System.Boolean"))
});
DT.Rows.Add(new object[] {10, "Text-10", true});
DT.Rows.Add(new object[] {20, "Text-20", false});
DT.Rows.Add(new object[] {30, "Text-30", false});
DT.Rows.Add(new object[] {40, "Text-40", true});
DT.Rows.Add(new object[] {50, "text-50", true});
//データセットを接続します
fpSpread1.DataSource = DS;
//特定フィールドのみを連結します
fpSpread1.ActiveSheet.Columns[0].DataField = "Check";
fpSpread1.ActiveSheet.Columns[1].DataField = "ID";
fpSpread1.ActiveSheet.ColumnCount = 2;
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'連結時の列自動生成を無効とします
FpSpread1.ActiveSheet.AutoGenerateColumns = False
'データセットを作成します
Dim DT As New DataTable
Dim DS As New DataSet
DT = DS.Tables.Add("SampleTable")
DT.Columns.AddRange(New DataColumn() { _
New DataColumn("ID", Type.GetType("System.Int32")), _
New DataColumn("Text", Type.GetType("System.String")), _
New DataColumn("Check", Type.GetType("System.Boolean")) _
})
DT.Rows.Add(New Object() {10, "Text-10", True})
DT.Rows.Add(New Object() {20, "Text-20", False})
DT.Rows.Add(New Object() {30, "Text-30", False})
DT.Rows.Add(New Object() {40, "Text-40", True})
DT.Rows.Add(New Object() {50, "Text-50", True})
'データセットを接続します
FpSpread1.DataSource = DS
FpSpread1.DataMember = "SampleTable"
'特定フィールドのみを連結します
FpSpread1.ActiveSheet.Columns(0).DataField = "Check"
FpSpread1.ActiveSheet.Columns(1).DataField = "ID"
FpSpread1.ActiveSheet.ColumnCount = 2
End Sub