473,386 Members | 1,799 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,386 software developers and data experts.

Does reading SelectedIndex on a combo box require an invoke?

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
2 2052
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shravan | last post by:
Hi, In my code sometimes the combox.selectedindex = <intIndex> doesn't set the combo selectedindex, when I checked the items in the combo the count is greater than <intIndex> Can anybody help...
0
by: Shravan | last post by:
Hi, When a combo is databound, the selectedindex before databinding is -1, after datbinding and painting them the selectedindex is 0, but the change in the selectedindex is not raising...
2
by: ABC | last post by:
How to pre-set combo textbox's selectedindex value from querystring passed from another page? I pass the querystring to set combo text box (change selectedindex on Page_Init). Source code as: ...
4
by: Kalvin | last post by:
I have seen this question raised, but I cannot find an answer. I have an MDI app, when I load an child form with a combobox being bound in the load event, it won't allow me to set selectedindex =...
0
by: Mike Eaton | last post by:
I searched and couldn't seem to find an explanation for this behavior, so I'm hoping someone here can explain it to me: I have a form with two combo boxes (set up as drop down lists) that display...
2
by: Mitchell Vincent | last post by:
Ok, I'm frustrated now. The simplest of things isn't working for me. I have this in my form's load event (after the combo is populated): If cmbCategory.SelectedIndex < 0 Then...
5
by: john.halet | last post by:
This line of code had been working with out issue, now its throwing errors. In my case I have three items in the ComboBox. If I try to change the selected index it throw the error. Earler in...
5
by: Eric A. Johnson | last post by:
Hi Everyone, I am at my wit's end here. I have a combobox (combyQueryTitle) that I need to use in order to select a query for my database project. Therefore, I am using the...
3
by: Soulless | last post by:
I would like to bind a combo box to my DSNs in windows. Any idea how i might accomplish this? I wouldl like to have the drop down display the available sources. I am searching but cannot find...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.