PowerTools SPREAD for Windows Forms 10.0J
DataSource プロパティ (FpSpread)


このコンポーネントのアクティブシートに読み込むデータソースの名前を取得または設定します。
構文
'Declaration
 
Public Property DataSource As Object
'使用法
 
Dim instance As FpSpread
Dim value As Object
 
instance.DataSource = value
 
value = instance.DataSource
public object DataSource {get; set;}

プロパティ値

データソースを含むObject
例外
例外説明
System.InvalidOperationExceptionシート数がゼロです。DataSource を設定するためには少なくとも1つのシートが存在する必要があります。
次のサンプルコードは、アクティブシートに読み込むデータソースの名前を指定します。
FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread();
FarPoint.Win.Spread.SheetView shv = new FarPoint.Win.Spread.SheetView();
fpSpread1.Location = new Point(10, 10);
fpSpread1.Height = 200;
fpSpread1.Width = 400;
Controls.Add(fpSpread1);
fpSpread1.Sheets.Add(shv);
DataSet ds = new DataSet();
DataTable emp = new DataTable("Employees");
DataTable div = new DataTable("Division");
emp.Columns.Add("LastName");
emp.Columns.Add("FirstName");
emp.Rows.Add(new Object[] {"Jones", "Marianne"});
emp.Rows.Add(new Object[] {"Fieldes", "Anna"});
div.Columns.Add("Section");
div.Columns.Add("Specialty");
div.Rows.Add(new Object[] {"Finance", "Taxes"});
div.Rows.Add(new Object[] {"Mergers", "Legal"});
ds.Tables.AddRange(new DataTable[] {emp, div});
fpSpread1.DataSource = ds;
fpSpread1.DataMember = "Division";
Dim fpSpread1 As New FarPoint.Win.Spread.FpSpread()
Dim shv As New FarPoint.Win.Spread.SheetView()
Dim info As New FarPoint.Win.Spread.StyleInfo()
info.BackColor = Color.LightBlue
fpSpread1.Location = New Point(10, 10)
fpSpread1.Height = 200
fpSpread1.Width = 400
Controls.Add(fpSpread1)
fpSpread1.Sheets.Add(shv)
Dim ds As New DataSet()
Dim emp As New DataTable("Employees")
Dim div As New DataTable("Division")
emp.Columns.Add("LastName")
emp.Columns.Add("FirstName")
emp.Rows.Add(New Object() {"Jones", "Marianne"})
emp.Rows.Add(New Object() {"Fieldes", "Anna"})
div.Columns.Add("Section")
div.Columns.Add("Specialty")
div.Rows.Add(New Object() {"Finance", "Taxes"})
div.Rows.Add(New Object() {"Mergers", "Legal"})
ds.Tables.AddRange(New DataTable() {emp, div})
fpSpread1.DataSource = ds
fpSpread1.DataMember = "Division"
参照

FpSpread クラス
FpSpread メンバ

 

 


© 2004-2017, GrapeCity inc. All rights reserved.