Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations & Events on Array

Status
Not open for further replies.

tobriain

Programmer
Jul 19, 2006
13
IE
I'm storing values in a series of arrays that are updated continously. I'll create a GUI with a series of custom controls to display all the different types of data for each entry.

If I want to run some kind of continuous scan or loop, checking for a certain conditions and then update my display accordingly, what would be the best way to do it? For example, if I've a group of integers in an array with lots of columns and rows, and I want to display something, or send values to a method for further calculation, when ((Row2Col5 - Row4Col10) >= Row15CCol20) (for example), what's the best way to do this?

With an event? A loop? Check the condition when some kind of OnArrayCellChangedEvent or something?

Thanks in advance,

Tom.
 
This sounds like you're doing multithreading. If so, there are some gotchas you need to know about.

1. Encapsulate all access to your shared array via lock statements to prevent concurrent access problems.
2. Use an event to notify the UI that the shared array has changed, because...
3. You can only update the UI on the same thread that created it, so handling the event tossed by the worker thread will give you that.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top