Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / August 2005

Tip: Looking for answers? Try searching our database.

comboBox_SelectedIndexChanged

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Swami - 30 Aug 2005 17:37 GMT
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.
Swami - 30 Aug 2005 17:41 GMT
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.

> I have 3 comboBoxes and the selectedIndexChanged event for all three call the
> same method  (ShowCorrectDisplay())....basically, the UI elements change
[quoted text clipped - 5 lines]
>
> Thanks.
John Bailo - 30 Aug 2005 17:47 GMT
Here's what I do.

Don't connect the selectedIndexChanged event handlers until after form load.

> I have 3 comboBoxes and the selectedIndexChanged event for all three call the
> same method  (ShowCorrectDisplay())....basically, the UI elements change
[quoted text clipped - 5 lines]
>
> Thanks.
Swami - 30 Aug 2005 17:58 GMT
oh, you mean change the order of declarations??

> Here's what I do.
>
[quoted text clipped - 9 lines]
> >
> > Thanks.
Swami - 30 Aug 2005 17:58 GMT
How do you that?

> Here's what I do.
>
[quoted text clipped - 9 lines]
> >
> > Thanks.
John Bailo - 30 Aug 2005 19:25 GMT
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_SelectedIndexChanged);
           
And comment it out...//

Then copy this same statement to the point in your form load, after
you've populated the comboboxes.

> How do you that?
>
[quoted text clipped - 11 lines]
>>>
>>>Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.