473,378 Members | 1,142 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,378 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 3654
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: 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
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...

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.