T
Tomasz Jastrzebski
Hi,
I want to display all DataSet tables in one DataRepeater. On the Form I have
DataRepeater with one DataGridView.
Then I try to programmatically create new DataRepeater items and bind my
DataGridView controls to DataTables.
The code fails with NullReferenceException at
Microsoft.VisualBasic.PowerPacks.NullDataManager.AddNew()
I spent entire afternoon looking for some useful examples and found nothing.
Could anyone help?
Thomas
sample test code:
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 5; i++) {
DataTable table = new DataTable();
table.Columns.Add("test1");
table.Columns.Add("test2");
this.dataRepeater1.AddNew(); // causes NullReferenceException
// at Microsoft.VisualBasic.PowerPacks.NullDataManager.AddNew()
DataGridView grid =
(DataGridView)this.dataRepeater1.CurrentItem.Controls[0];
grid.DataSource = table;
}
}
I want to display all DataSet tables in one DataRepeater. On the Form I have
DataRepeater with one DataGridView.
Then I try to programmatically create new DataRepeater items and bind my
DataGridView controls to DataTables.
The code fails with NullReferenceException at
Microsoft.VisualBasic.PowerPacks.NullDataManager.AddNew()
I spent entire afternoon looking for some useful examples and found nothing.
Could anyone help?
Thomas
sample test code:
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 5; i++) {
DataTable table = new DataTable();
table.Columns.Add("test1");
table.Columns.Add("test2");
this.dataRepeater1.AddNew(); // causes NullReferenceException
// at Microsoft.VisualBasic.PowerPacks.NullDataManager.AddNew()
DataGridView grid =
(DataGridView)this.dataRepeater1.CurrentItem.Controls[0];
grid.DataSource = table;
}
}