By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,192 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,192 IT Pros & Developers. It's quick & easy.

Does reading SelectedIndex on a combo box require an invoke?

P: n/a
Hi,

If you're not on the UI thread - responding to a network event, say - and
you want to read the SelectedIndex of a combo box, do you have to do an
Invoke? Or is it just a simple data read with no windows messages involved?

The reason I ask is that in some of my handlers if the SelectedIndex is -1,
then I can return from the event handler straight away with no need for any
further work. Doing an Invoke just for that seems a bit long-winded.

Ta,

Adam.

==============================
Ad*********@Omnibus.NOSPAMMYSPAMSPAM.co.uk
Feb 5 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Perhaps keep a volatile or sync-locked field somewhere, and update it
on the UI thread when the SelectedIndexChanged event fires; then in
your non-UI thread can just check this field, without having to go to
the UI thread.

Marc
Feb 5 '08 #2

P: n/a
Thanks, Marc and Peter.

I suspected as much but wanted to be sure - I'm currently having to work
under VS.NET 2003 so I don't get cross thread exceptions, just a lock up
when you least expect it!

- AB
======
Feb 6 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.