How to display data repeater control in win-form?
i am using windows applications. in that form i am using DataRepeater control. i display numbers in that control. (vs 2010)
My code
DataTable dt = new DataTable();
dt.Columns.Add("c1");
dt.Rows.Add("1");
dt.Ro开发者_如何学Pythonws.Add("2");
dt.Rows.Add("3");
dt.Rows.Add("4");
dt.Rows.Add("5");
dt.Rows.Add("6");
dt.Rows.Add("7");
dt.Rows.Add("8");
dt.Rows.Add("9");
dt.Rows.Add("10");
textBox1.DataBindings.Add("Text", dt, "c1");
dataRepeater1.DataSource = dt;
i changed a Layoutstyle is Horizontal that time it display all numbers in row. But my aim is one row display only 6 numbers after that 7th number onwards it display next row. similarly to all numbers.
How to do this?..
Any ideas are welcome.
please help me.
You will need to package the 6 number batches into another class:
class Batch
{
public int One {get;set;}
// etc
}
And give the data repeater a list of these:
var l = new List<Batch>();
dataRepeater1.DataSource = l;
Your repeater will then need controls inside it that look at the properties on the Batch
class. The class wrapper is required because the repeater will repeat for each item in a collection (row in a DataTable
for example) so to group them, you need to do that manually.
Further reading:
http://blogs.msdn.com/b/vsdata/archive/2009/08/12/datarepeater-control-for-windows-forms.aspx
精彩评论