473,326 Members | 2,104 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,326 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 2531
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.