Spread Windows Forms 7.0 Product Documentation
AutoGenerateRow Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.Data Namespace > SpreadDataBindingAdapter Class : AutoGenerateRow Property


Glossary Item Box

Gets or sets whether a row or column is automatically generated when filling data.

Syntax

Visual Basic (Declaration) 
Public Property AutoGenerateRow As Boolean
Visual Basic (Usage)Copy Code
Dim instance As SpreadDataBindingAdapter
Dim value As Boolean
 
instance.AutoGenerateRow = value
 
value = instance.AutoGenerateRow
C# 
public bool AutoGenerateRow {get; set;}

Property Value

Boolean: true if the row or column is generated automatically when filling data; false otherwise

Example

This example sets the AutoGenerateRow property.
C#Copy Code
DataSet ds = new DataSet();
DataTable dt = default(DataTable);
dt = new DataTable();
dt.Columns.Add(new DataColumn("Number1", typeof(string)));
dt.Columns.Add(new DataColumn("Number2", typeof(string)));
dt.Columns.Add(new DataColumn("Number3", typeof(string)));
dt.Columns.Add(new DataColumn("Text1", typeof(string)));
dt.Columns.Add(new DataColumn("Text2", typeof(string)));
dt.Columns.Add(new DataColumn("Text3", typeof(string)));
dt.Columns.Add(new DataColumn("Text4", typeof(decimal)));
dt.Rows.Add(new object[] { "101", "1", "0", "Num1", "Num2", "Num3", 21000 });
dt.Rows.Add(new object[] { "201", "2", "0", "a", "b", "c", 9400 });
dt.Rows.Add(new object[] { "203", "2", "0", "Jan", "Feb", "March", 4550 });
dt.Rows.Add(new object[] { "301", "3", "1", "First", "Second", "Third", 32000 });
dt.Rows.Add(new object[] { "302", "3", "1", "Test", "Test1", "Test2", 13280 });
dt.Rows.Add(new object[] { "204", "2", "0", "Mon", "Tues", "Wed", 1700 });
dt.Rows.Add(new object[] { "303", "3", "1", "Week1", "Week2", "Week3", 36080 });
dt.Rows.Add(new object[] { "402", "4", "1", "d", "e", "f", 31500 });
dt.Rows.Add(new object[] { "405", "4", "1", "July", "August", "September", 4958 });
dt.Rows.Add(new object[] { "102", "1", "0", "next", "aaa", "max", 1539 });
ds.Tables.Add(dt);

FarPoint.Win.Spread.Data.SpreadDataBindingAdapter Sdba = new FarPoint.Win.Spread.Data.SpreadDataBindingAdapter();
Sdba.DataSource = ds.Tables[0];
Sdba.Spread = fpSpread1;
Sdba.SheetName = fpSpread1.ActiveSheet.SheetName;
Sdba.AutoGenerateRow = true;
Sdba.DataAutoCellTypes = false;  
Sdba.MapperInfo = new FarPoint.Win.Spread.Data.MapperInfo(2, 0, 10, 7);   
Sdba.FillSpreadDataByDataSource();
VB.NETCopy Code
Dim ds As New DataSet()
Dim dt As DataTable = Nothing
dt = New DataTable()
dt.Columns.Add(New DataColumn("Number1", GetType(String)))
dt.Columns.Add(New DataColumn("Number2", GetType(String)))
dt.Columns.Add(New DataColumn("Number3", GetType(String)))
dt.Columns.Add(New DataColumn("Text1", GetType(String)))
dt.Columns.Add(New DataColumn("Text2", GetType(String)))
dt.Columns.Add(New DataColumn("Text3", GetType(String)))
dt.Columns.Add(New DataColumn("Text4", GetType(Decimal)))
dt.Rows.Add(New Object() {"101", "1", "0", "Num1", "Num2", "Num3", 21000})
dt.Rows.Add(New Object() {"201", "2", "0", "a", "b", "c", 9400})
dt.Rows.Add(New Object() {"203", "2", "0", "Jan", "Feb", "March", 4550})
dt.Rows.Add(New Object() {"301", "3", "1", "First", "Second", "Third", 32000})
dt.Rows.Add(New Object() {"302", "3", "1", "Test", "Test1", "Test2", 13280})
dt.Rows.Add(New Object() {"204", "2", "0", "Mon", "Tues", "Wed", 1700})
dt.Rows.Add(New Object() {"303", "3", "1", "Week1", "Week2", "Week3", 36080})
dt.Rows.Add(New Object() {"402", "4", "1", "d", "e", "f", 31500})
dt.Rows.Add(New Object() {"405", "4", "1", "July", "August", "September", 4958})
dt.Rows.Add(New Object() {"102", "1", "0", "next", "aaa", "max", 1539})
ds.Tables.Add(dt)

Dim Sdba As New FarPoint.Win.Spread.Data.SpreadDataBindingAdapter()
Sdba.DataSource = ds.Tables(0)
Sdba.Spread = FpSpread1
Sdba.SheetName = FpSpread1.ActiveSheet.SheetName
Sdba.AutoGenerateRow = True
Sdba.DataAutoCellTypes = False
Sdba.MapperInfo = New FarPoint.Win.Spread.Data.MapperInfo(2, 0, 10, 7)
Sdba.FillSpreadDataByDataSource()

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.