473,403 Members | 2,354 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,403 software developers and data experts.

comboBox_SelectedIndexChanged

I have 3 comboBoxes and the selectedIndexChanged event for all three call the
same method (ShowCorrectDisplay())....basically, the UI elements change
depending on which element is selected. However, the problem is that when my
form initially loads, the initially selected index of only combo box is
important....but my code calls the the ShowCorrectDisplay() method 3 times
during initial form load even though that is unneccessary. Is there any way
to do a check if (!formLoad) then ShowCorrectDisplay()?

Thanks.
Aug 30 '05 #1
5 2534
Sorry, just correcting a sentence:

However, the problem is that when my
form initially loads, the initially selected index of only ONE combo box is
important.
"Swami" wrote:
I have 3 comboBoxes and the selectedIndexChanged event for all three call the
same method (ShowCorrectDisplay())....basically, the UI elements change
depending on which element is selected. However, the problem is that when my
form initially loads, the initially selected index of only combo box is
important....but my code calls the the ShowCorrectDisplay() method 3 times
during initial form load even though that is unneccessary. Is there any way
to do a check if (!formLoad) then ShowCorrectDisplay()?

Thanks.

Aug 30 '05 #2

Here's what I do.

Don't connect the selectedIndexChanged event handlers until after form load.
Swami wrote:
I have 3 comboBoxes and the selectedIndexChanged event for all three call the
same method (ShowCorrectDisplay())....basically, the UI elements change
depending on which element is selected. However, the problem is that when my
form initially loads, the initially selected index of only combo box is
important....but my code calls the the ShowCorrectDisplay() method 3 times
during initial form load even though that is unneccessary. Is there any way
to do a check if (!formLoad) then ShowCorrectDisplay()?

Thanks.

Aug 30 '05 #3
oh, you mean change the order of declarations??

"John Bailo" wrote:

Here's what I do.

Don't connect the selectedIndexChanged event handlers until after form load.
Swami wrote:
I have 3 comboBoxes and the selectedIndexChanged event for all three call the
same method (ShowCorrectDisplay())....basically, the UI elements change
depending on which element is selected. However, the problem is that when my
form initially loads, the initially selected index of only combo box is
important....but my code calls the the ShowCorrectDisplay() method 3 times
during initial form load even though that is unneccessary. Is there any way
to do a check if (!formLoad) then ShowCorrectDisplay()?

Thanks.

Aug 30 '05 #4
How do you that?

"John Bailo" wrote:

Here's what I do.

Don't connect the selectedIndexChanged event handlers until after form load.
Swami wrote:
I have 3 comboBoxes and the selectedIndexChanged event for all three call the
same method (ShowCorrectDisplay())....basically, the UI elements change
depending on which element is selected. However, the problem is that when my
form initially loads, the initially selected index of only combo box is
important....but my code calls the the ShowCorrectDisplay() method 3 times
during initial form load even though that is unneccessary. Is there any way
to do a check if (!formLoad) then ShowCorrectDisplay()?

Thanks.

Aug 30 '05 #5

Open up the section of code entitled:

#region Windows Form Designer generated code

Then find the statement

this.comboBox3.SelectedIndexChanged += new
System.EventHandler(this.comboBox3_SelectedIndexCh anged);

And comment it out...//

Then copy this same statement to the point in your form load, after
you've populated the comboboxes.
Swami wrote:
How do you that?

"John Bailo" wrote:

Here's what I do.

Don't connect the selectedIndexChanged event handlers until after form load.
Swami wrote:
I have 3 comboBoxes and the selectedIndexChanged event for all three call the
same method (ShowCorrectDisplay())....basically, the UI elements change
depending on which element is selected. However, the problem is that when my
form initially loads, the initially selected index of only combo box is
important....but my code calls the the ShowCorrectDisplay() method 3 times
during initial form load even though that is unneccessary. Is there any way
to do a check if (!formLoad) then ShowCorrectDisplay()?

Thanks.

Aug 30 '05 #6

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

Similar topics

3
by: Ceci | last post by:
I need help!! I'm using the selectedindexchanged event of a combobox to fill another combobox according to the selected value of the first one, but the combobox_selectedindexchanged happens twice...
0
by: dmanhr | last post by:
Hi, I'm developing a control (derived from ComboBox) with permanent items (First, Previous, Next, Last). So, I'd like it's collection of items couldn't be changed neither in design time nor...
2
by: juli | last post by:
Hello, I am trying to react to a selection change in a combobox which is filled dynamicly during the run of the program. I am trying to do the following: 1)Declaring the comboBox 2)Initializing...
19
by: juli jul | last post by:
Hello, I would like to know if there is a function which is running during the runtime of my program all the time and where I could place events overloading and things I need to check during the...
0
by: Ken Arway | last post by:
Using .Net framework 1.1 I've got a Windows Forms application with a tab control having four tab pages. TabPage4 contains a Combobox and a TextBox, which are bound to the same XML file as a...
3
by: Suresh | last post by:
I have a combo and a datagrid in a page. Combo box values are loaded on page_Load. Datagrid is populated based on values selected in the combo (I am using selectedIndexchange event) I need to...
5
by: Swami | last post by:
I have 3 comboBoxes and the selectedIndexChanged event for all three call the same method (ShowCorrectDisplay())....basically, the UI elements change depending on which element is selected. ...
4
by: PSL | last post by:
Hi, I am going through the training C# For Programmers made by TestOut and like the presentation. The only problem is that this tutorial has a nastie bug that renders this software practically...
1
by: syedfasih | last post by:
I am working on a Saloon Application in which I am generation the appointment system, I have a column in a Gridview in which a ComboboxColumn is embeded that contains services that saloon provides. I...
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: 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...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.