Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-21-2006, 04:19 PM   #1 (permalink)
khanhlq
Registered User
 
Join Date: Mar 2006
Posts: 7
khanhlq is on a distinguished road
Deleted by foreach row

Quote:
foreach(UltraGridRow delRow in UGMain.Rows)
{
if(delRow.Selected)
delRow.Delete(false);
]
UGMain = UltraGrid
I deleted one row, but index wrong and can't delete in the right. Plz help me
khanhlq is offline   Reply With Quote
Old 03-22-2006, 06:54 PM   #2 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
Is this for a web application or windows application?
__________________
~Ryan

rdove is offline   Reply With Quote
Old 03-22-2006, 09:26 PM   #3 (permalink)
khanhlq
Registered User
 
Join Date: Mar 2006
Posts: 7
khanhlq is on a distinguished road
application
khanhlq is offline   Reply With Quote
Old 03-22-2006, 10:19 PM   #4 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 596
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Q. choice A or choice B ?
A. choice
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 03-23-2006, 06:36 AM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,695
redhead is on a distinguished road
I guess you would get A+++ on every test, if that answer was accepted....
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 03-24-2006, 07:47 AM   #6 (permalink)
kyoryu
Registered User
 
Join Date: Apr 2003
Posts: 34
kyoryu is on a distinguished road
Quote:
Originally Posted by khanhlq
UGMain = UltraGrid
I deleted one row, but index wrong and can't delete in the right. Plz help me
While I'm not familiar with UltraGrid, it looks to me like the act of deleting the first row may be invalidating your iterator.

Adding the rows to be deleted to a separate collection, and using that to do the actual deletion is an option... using a list and then just popping off the values may work well.

Another thing that can work well for deleting items from a list is iterating over the list, by index instead of foreach, but doing so in reverse. This guarantees that your next lower index is still valid.
kyoryu is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlight a DataGrid Row and Stay there - rikb53 MS Technologies ( ASP, VB, C#, .NET ) 0 03-09-2006 11:26 AM
check if a vector equals to a row in a 2D matrix benllera Standard C, C++ 2 07-07-2005 07:54 AM
Row Adding Problems Phantek Everything SQL ( MySQL, MSSQL, DB2, Postgre, Oracle, etc...) 2 05-24-2005 07:13 AM
Row Decrement Phantek Everything SQL ( MySQL, MSSQL, DB2, Postgre, Oracle, etc...) 6 05-20-2005 10:59 AM
foreach() while() for() or new mysql query? nemesis PHP 6 06-10-2003 06:57 PM


All times are GMT -8. The time now is 02:23 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting