C#: Using Combo Boxes

Started by
5 comments, last by BeanDog 18 years, 4 months ago
What is the event handler for when some one makes a selection in a combo box?
Advertisement
Did you try SelectedIndexChanged or SelectedValueChanged?
Quote:Original post by Fixxer
What is the event handler for when some one makes a selection in a combo box?

You've asked a lot of these questions lately. Are you sure you're making a determined effort to check the documentation first? The MSDN docs that come with any copy of Visual Studio contain information on pretty much every single public and protected class member in the framework.

For instance, I found the answer to your question in about three seconds merely by scanning the ComboBox event handler list: SelectedIndexChanged

Also, from our Forum FAQ:

Quote:from the Forum FAQ
(1) Ask intelligent questions. A question is not intelligent if its answer is something you could find with a little bit of effort or a quick Google search.
- k2"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {[email=kkaitan at gmail dot com]e-mail me[/email]} | {excellent webhosting}
Aye sirs and or ma ams.
Here is a better question then :)

I am having trouble typing out event handlers.
I cant find whats wrong with this one, the intellisense even completed it for me.

WebBrowersWin.Navigating +=new WebBrowserNavigatingEventHandler(WebBrowersWin_Navigating);
http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowsernavigatingeventhandler.aspx
- GDKnight
I know, I have everything typed correctly and in the correct spots, but I keep getting this error.

Error 1 The name 'WebBrowersWin_Navigating' does not exist in the current context C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Xiemsoft Web Portal\Xiemsoft Web Portal\Form1.cs 28 78 Xiemsoft Web Portal

WebBrowersWin.Navigating += new WebBrowserNavigatingEventHandler(WebBrowersWin_Navigating);

and it underlines WebBrowersWin_Navigating
Type:

WebBrowersWin.Navigating +=

And the IntelliSense should bring up the correct right hand side. Hit tab to fill it in. Then hit tab again to automatically create a function that receives the event.

Also, the better way to do it is to open the form in the designer view, right-click on the control, select Properties. In the Properties view, click the little lightning-bolt icon to see a list of events. Double-click the blank space to the right of the event you want to handle, and it will automatically set it up and take you right to where you can type code for that event.



~BenDilts( void );

This topic is closed to new replies.

Advertisement