473,395 Members | 2,006 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,395 software developers and data experts.

Suspend CollectionChanged event in BaseCollection class

Joe
Hello,

I have a class that inherits from BaseCollection. I want to implement a Move
method so an item in the collection can be moved from one index postion to
another for example index = 5 to index = 2.

I don't want the CollectionChanged event to get called when I remove the
item and do an Insert.

Is there anyway to suspend the event in my class that inherits from
BaseCollection?

Thanks,
Joe
Oct 6 '08 #1
3 1972
On Mon, 06 Oct 2008 09:09:37 -0700, Joe <jb*******@noemail.noemailwrote:
I have a class that inherits from BaseCollection. I want to implement a
Move
method so an item in the collection can be moved from one index postion
to
another for example index = 5 to index = 2.

I don't want the CollectionChanged event to get called when I remove the
item and do an Insert.

Is there anyway to suspend the event in my class that inherits from
BaseCollection?
Can you clarify? The System.Windows.Forms.BaseCollection class doesn't
have a CollectionChanged event.

Pete
Oct 6 '08 #2
Joe
Sorry it turned out this was our BaseCollection.

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Mon, 06 Oct 2008 09:09:37 -0700, Joe <jb*******@noemail.noemailwrote:
>I have a class that inherits from BaseCollection. I want to implement a
Move
method so an item in the collection can be moved from one index postion
to
another for example index = 5 to index = 2.

I don't want the CollectionChanged event to get called when I remove the
item and do an Insert.

Is there anyway to suspend the event in my class that inherits from
BaseCollection?

Can you clarify? The System.Windows.Forms.BaseCollection class doesn't
have a CollectionChanged event.

Pete

Oct 7 '08 #3
Hi Joe,

Thank you for the clarify. Then, do you still need any help on this issue?

Basically, since you implement the event yourself, you may use some private
flag to control if this event should be fired. When you are implementing
the "Move" method, you may set this flag, so that the all the internal
operations will honor this flag and will not fire CollectionChanged event.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 8 '08 #4

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

Similar topics

1
by: Alessandro Rossi | last post by:
I've developed a user control, and i want to use this control in forms that has others controls linked to a dataset (TextBox). I want to add a delegate to the CollectionChanged event of the...
8
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause...
2
by: juky | last post by:
Hi all, I have a loop in the thread checking for a particular service status, whenever the status changes to "stopped" a RaiseEvent is generated by thread and another function runs. At the same...
3
by: dr | last post by:
I created a basic service using VS2005. Add OnPowerEvent method as detailed on MSDN and return false to a PowerBroadcastStatus.QuerySuspend notification. The service also has set...
6
by: Robert Speck | last post by:
Hi there, Can anyone shed anymore light on why "Thread.Suspend()" has been deprecated by MSFT beyond what MSDN says about it. I'm not sure if I quite appreciate the various pitfalls they discuss...
8
by: MrNobody | last post by:
If I have a control like say a drop down list and I have some kind of onSelectItem change event, is there a way to temporarily suspend the event handling (without removing the event and then...
6
by: Buddy Home | last post by:
Hello, I want to understand whats the best way to write code to replace Thread.Suspend, Thread.Resume and Thread.Abort. I have lots of code calling these existing methods and want to minimize...
1
by: Mike Fellows | last post by:
Having not used threads for such a long time in vb.net I have found myself in need of them I have a thread that runs and retirieves live data from a SQL database, this is running fine and has...
0
by: stexcec | last post by:
Hi All, I'm new with dataGridView control, and I would implement a form with such grid bounded to a custom collection (maybe a dictionary). Now , I can change the data in my dictionary, and then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.