473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

PropertyDescriptorCollection.Remove()

Hi all,

I have a general question concerning the capability of the
PropertyDescriptorCollection. It seems to be impossible to remove a
PropertyDescriptor savely using Remove or RemoveAt. I use framework
1.1. Why does the following code always crash resulting in the error
message "Source array was not long enough. Check srcIndex and length,
and the array's lower bounds.":

PropertyDescriptorCollection PDC = new
PropertyDescriptorCollection(null);
PDC.Add(new MyItemDescriptor(null, "first", ""));
PDC.Add(new MyItemDescriptor(null, "second", ""));
PDC.RemoveAt(0);

But removing the second element works this time:

PropertyDescriptorCollection PDC = new
PropertyDescriptorCollection(null);
PDC.Add(new MyItemDescriptor(null, "first", ""));
PDC.Add(new MyItemDescriptor(null, "second", ""));
PDC.RemoveAt(1);

For me it's impossible to foresee when it will fail, sometimes it's
removable sometimes not.

Thanks in advance,

Frank
Jul 21 '05 #1
1 2197
Im having the same problem. I stepped through my code, and the Length of
the PropertyDescriptorCollection implementation was 2, when I got this
error.

It was trying to remove element at position 0.

Brian Takita

FrankYM wrote:
Hi all,

I have a general question concerning the capability of the
PropertyDescriptorCollection. It seems to be impossible to remove a
PropertyDescriptor savely using Remove or RemoveAt. I use framework
1.1. Why does the following code always crash resulting in the error
message "Source array was not long enough. Check srcIndex and length,
and the array's lower bounds.":

PropertyDescriptorCollection PDC = new
PropertyDescriptorCollection(null);
PDC.Add(new MyItemDescriptor(null, "first", ""));
PDC.Add(new MyItemDescriptor(null, "second", ""));
PDC.RemoveAt(0);

But removing the second element works this time:

PropertyDescriptorCollection PDC = new
PropertyDescriptorCollection(null);
PDC.Add(new MyItemDescriptor(null, "first", ""));
PDC.Add(new MyItemDescriptor(null, "second", ""));
PDC.RemoveAt(1);

For me it's impossible to foresee when it will fail, sometimes it's
removable sometimes not.

Thanks in advance,

Frank

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
11
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper...
6
by: Arne Claus | last post by:
Hi If've just read, that remove() on a list does not actually remove the elements, but places them at the end of the list (according to TC++STL by Josuttis). It also says, that remove returns a...
3
by: Don | last post by:
My user control has a combobox with an arraylist attached to it along with custom add and remove methods. The "Add" method is working great. However I don't understand why the "Remove" method...
1
by: FrankYM | last post by:
Hi all, I have a general question concerning the capability of the PropertyDescriptorCollection. It seems to be impossible to remove a PropertyDescriptor savely using Remove or RemoveAt. I use...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
6
by: tshad | last post by:
Is there a reason to use session.remove over session.contents.remove? Don't they both remove the key and data from the contents collection? I assume that session(x) = nothing does essentially...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
6
by: sam_cit | last post by:
Hi Everyone, I'm using remove() function to delete a file, and i observed the following behavior, Concerned file : sample.txt Operation : i open the file in read mode and don't close the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.