471,831 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Urgent! IEnumerator and InvalidOperationException


I'm having problems in enumerating checked items of checkedlistbox. I'm trying to do following

string sVal

foreach(myObject _myobj in checkedListBox1.CheckedItems

sVal = _myobj.value
MessageBox.Show( this, "Value = " + sVal)
The checkedlistbox is in tabPane, which in turn is in tabControl. When doing the foreach, the debugger does succesfully first round, but in the beginning of second iteration round System.InvalidOperationException is thrown. I suppose, that runtime may "clear" checkedlistbox after control has exited. How can I prevent this

My application aims in the following procedure

tabPane1 contains checkedlistbox1 of car manufacturer
tabPane2 contains checkedlistbox2 of car mode
tabPane3 contains checkedlistbox2 of engine typ

I'd like to display multiple car models and compare their properties with each other. E.g

tabPane1 a list of car brands is shown, user chooses Volkswagen and Volv
tabPane2,a list of appropriate models from DB is fetched based on user's previous choices, and the user chooses (VW) Passat, (VW) Golf and (Volvo) S40, (Volvo) V7
tabPane3, again DB calls, user wants to compare VW Passat 1.9TDi Comfort Line, VW Golf 1.8 First Line and Volvo S40 1.8T and Volvo V70 2.5TDi Wago

-> program fetches appropriate information about the chosen car models from DB and displays comparison data for the user

Any good examples, design tips and patterns concerning this is highly appreciated. Sorry for my poor English and a little complicated sample

Nov 15 '05 #1
0 953

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Stefan Bauer | last post: by
28 posts views Thread by Tamir Khason | last post: by
16 posts views Thread by | last post: by
7 posts views Thread by zeyais | last post: by
33 posts views Thread by dembla | last post: by
8 posts views Thread by ginnisharma1 | last post: by
3 posts views Thread by N. Spiker | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by aboka | last post: by

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.