.NewRow() Error - An Item with the same key has already been added.


Author
Message
jsantos
jsantos
StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 87
Hello,

I am having an issue when calling .NewRow I get an error in the CreateShareAndAddBusinessObject function in BusinessBindingSource.vb (see attached image)

Before calling the .NewRow in our code the CurrentRowIndex = -1 which I expect as the BO should be empty. Then as soon as I call .NewRow I get an exception. When the error is thrown index = 0 when it should be 1 according to loReturn where it looks like there is already one record and then the error makes sense.

Any ideas?

http://forum.strataframe.net/Uploads/Images/c855b057-bc96-4ba1-a242-0e50.png
Replies
jsantos
jsantos
StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 87
Sorry about the image. Added attachment

We are adding a new row programatically. As I understand .NewRow is recommended for programatically adding new rows.
Attachments
Error1.png (370 views, 53.00 KB)
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi,

Thanks for the image and yes, NewRow() is recommended for adding rows programmatically.

Still, can you please explain in a wider scope what you are trying to do?  also it will help if you can post the code Sub or Function where you are trying to add the new record?

I use BBS with DevExpress all the time and have notice that when showing records in the DevEx grid using the BBS, and using the same source BO to modify the record, all kind of error show up.  My solution is to use 2 BO, one for the BBS to show in read only grid and one for make the changes.  I know this logic will require more code to keep the grid in synch with updates to 2nd BO, but that have worked for me all the time.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
jsantos - 10 Years Ago
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
Edhy Rijo - 10 Years Ago
                     Yep, Edhy, the WPF ICollectionView and...
StrataFrame Team - 10 Years Ago
                         Yes, Ben you are right. I remember long time ago when I was starting...
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
Edhy Rijo - 10 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search