473,412 Members | 4,966 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,412 software developers and data experts.

Combobox.SelectedIndexChanged

I use a AddHandler statement in the load event of a form to assoicate a
routine with a combobox. When I populate the form, I select the approiate
value from the combobox by using combobox.selectedvalue = value. The weird
thing is sometimes this causes the assoicated routine to be called and
sometimes it does not. The combobox below it that is completely identical
except for the name works every time. After the form is displayed, you can
select something from the combobox and the routine fires.

Does anybody know why this is happening or has anybody had anything similiar
to this happen to them?
Nov 21 '05 #1
2 3659
I figured it out. I feel like an idiot! The reason the SelectedIndexChanged
event was not firing was because the SelectedIndex was not changing. I was
thinking that after populating the combobox that Nothing(-1) would be
selected, however, I forgot to set it to Nothing after populating it. So, of
course, the first item was automatically displayed/selected. So whenever I
tried to set the selectedvalue of the combobox to the value at index 0, in
code after populating it, the SelectedIndexChanged event would not fire
because it was already selected!

"blue_nirvana" wrote:
I use a AddHandler statement in the load event of a form to assoicate a
routine with a combobox. When I populate the form, I select the approiate
value from the combobox by using combobox.selectedvalue = value. The weird
thing is sometimes this causes the assoicated routine to be called and
sometimes it does not. The combobox below it that is completely identical
except for the name works every time. After the form is displayed, you can
select something from the combobox and the routine fires.

Does anybody know why this is happening or has anybody had anything similiar
to this happen to them?

Nov 21 '05 #2
I figured it out. I feel like an idiot! The reason the SelectedIndexChanged
event was not firing was because the SelectedIndex was not changing. I was
thinking that after populating the combobox that Nothing(-1) would be
selected, however, I forgot to set it to Nothing after populating it. So, of
course, the first item was automatically displayed/selected. So whenever I
tried to set the selectedvalue of the combobox to the value at index 0, in
code after populating it, the SelectedIndexChanged event would not fire
because it was already selected!

"blue_nirvana" wrote:
I use a AddHandler statement in the load event of a form to assoicate a
routine with a combobox. When I populate the form, I select the approiate
value from the combobox by using combobox.selectedvalue = value. The weird
thing is sometimes this causes the assoicated routine to be called and
sometimes it does not. The combobox below it that is completely identical
except for the name works every time. After the form is displayed, you can
select something from the combobox and the routine fires.

Does anybody know why this is happening or has anybody had anything similiar
to this happen to them?

Nov 21 '05 #3

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

Similar topics

0
by: Anthony | last post by:
is there a way to stop combox from firing SelectedIndexChanged events on loading when it is databinded? everytime my form loads, SelectedIndexChanged fires 4 times? using System; using...
3
by: ScottO | last post by:
I would like the user to have to select something in a System.Windows.Forms.ComboBox. private void MyForm_Load(object sender, System.EventArgs e) { ... comboBox.DataSource = data;...
0
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows...
4
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank...
7
by: sparkle | last post by:
Hi Everybody, I'm filling a combobox from a class, which works fine on it's own. But when I insert code to fill in other controls something in the combobox fill is causing the...
4
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList...
0
by: peter78 | last post by:
I wanted to implement an autocomplete feature on the combobox where you would type in partial text and it would try to match it for you. It doesn't exist in .Net yet, but I'm guessing it will in...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
2
by: tshad | last post by:
In my VS 2003 Windows Forms page, when I initially fill my ComboBox (SystemList), it goes to the SelectedIndexChanged event which calls the Loademails() function. I then call it again in the...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.