Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Problem with adding table rows


Message #1 by "Bhagvan Chougule" <bhagvan@a...> on Wed, 5 Feb 2003 12:10:59
Thank you very much. Now it works fine.
Can you please suggest me the book for asp.net. i didn't get this anywhere 
that rows gets moved from one table to another.

> The reason is that, as you move items from one table to another, the
Rows collection of the original table gets smaller.

Try something like (c#):
while(myTable.Rows.Count>0)
{
	Table1.Rows.Add(myTable.Rows[0]);
}


-----Original Message-----
From: Bhagvan Chougule [mailto:bhagvan@a...]=20
Sent: 5. februar 2003 13:11
To: ASPX_Professional
Subject: [aspx_professional] Problem with adding table rows


I have written a control which returns table with some rows. I want to
add=20
rows from that table to another on web form onwhich the control  is.

The codeis like this,
       =20
        Dim myTR As TableRow
        Dim myTable =3D New Table()
        myTable =3D PersonalContent1.GetLHContent
        For Each myTR In myTable.Rows
            Table1.Rows.Add(myTR)
        Next

It gives an error

The list that this enumerator is bound to has been modified. An
enumerator=20
can only be used if the list doesn't change.=20

Also the following code works  fine

        Table1.Rows.Add(myTable.Rows(2))
        Table1.Rows.Add(myTable.Rows(1))
        Table1.Rows.Add(myTable.Rows(0))

But when sequence is changed it gives error

        Table1.Rows.Add(myTable.Rows(2))
        Table1.Rows.Add(myTable.Rows(1))
        Table1.Rows.Add(myTable.Rows(0))

myTable content 3 rows

The error is
Specified argument was out of the range of valid values. Parameter name:

index=20

Please help me to resolve this.
thanx in  advance


---
Change your mail options at http://p2p.wrox.com/manager.asp or=20
to unsubscribe send a blank email to


  Return to Index