new to c# help required :)

my background is from vb and kinda confuse me a lot when it comes to even.handels

my questions is: in when you double click any control the creates for you the event handler for an example

if i double click on the ddl and i will get:

 Private Sub ddl_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddl.SelectedIndexChanged
but in c# it does not create handles and how should create those handles? what is the best way and after is spent 1 hour i figured out that there is place called >>>private void InitializeComponent()<<< where it initialize all the handles but what if if i don't know the correct handles ?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
Hi allday;

In C#'s IDE it works a little different. The double click a control in C# is accomplished in this way, in the forms designer click on the control then goto the Properties window and click on the lightning bult just below the combo box at the top of the Properties window. Find the event you want and double click on the event to create the  stub for that event, you will then be taken to that event in the code. If you would like to create an event stub with youe own name type that name in the text box next to the event name and press return.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chinmay PatelChief Technology NinjaCommented:
Hi There,

I guess... even C# creates stub automatically which version of VS 2003 you are using?

Chinmay PatelChief Technology NinjaCommented:
Hi There,

ooops! I mean which version of Visual Studio you are using?

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

alldayAuthor Commented:
i'm using vs 2003
Fernando SotoRetiredCommented:
Did not my comment at the top answer you question?
Ya, Fernando is on the ball with this one.  The auto-wireup functionality is internal to the IDE and there's no kind of configuration setting that could
accidentally get flubbed up (that's not to say that the mechanisms responsible for carrying out the auto-wireup can't get flubbed up).
The question is, was this a one time occurance or is this (to use Microsofts terminology) "anomaly" reproduceable?

For some last resort troubleshooting points-of-reference:
a) When you double click a control in the Forms Designer, does it automatically switch you to Code View?
        a.1) If it does switch you to Code View, where is the cursor coming to rest? It may be the case that the
               event handler is being defined, but it doesn't automatically take you directly to the handler definition.
        a.2) If if does NOT switch to Code View, does it do anything? Is there any kind of indication as to the current status in
               the Output window or any other indication as to the programs status?
b) Is it only a DDL control that you're having issues with, or any control you double click?
        b.1) If it's only certain control(s), you could try removing the suspect control from the toolbox, and then
               adding it again.
               To remove a control, right click the control in the toolbox, select "Add/Remove Item", navigate to the corresponding
               checkbox for the control and uncheck it. The reverse is true to add the control back in.
        b.2) While in the process of doing b.1, you could also take note of the associated Assembly, which is listed in the third
               column of the Add/Remove dialog box that comes up, and do some investigating through the .NET assembly configuration
               utility in your Administrator Tools folder. It's actually just an MMC snap-in that you can access from a run prompt if that's
               your preference.
c) Are the rest of the required statements being added? Namely, the Form classes instance variable for the control (private System.Windows.Forms.DDL ddl_name),
    the object instantiation statement (this.ddl_name = new System.Windows.Forms.DropDownList()),
    the wireup statement (this.ddl_name += new System.EventHandler(this.ddl_nameEvent)).
        c.1) If all three aren't present or are somehow incorrect, it could be causing problems.
        c.2) After you double-click the control and no event handler is defined, does the solution still build with no errors? If there are errors, are any related to the DDL control?

Again, those are just some general things to look at which may possibly shed some light on extenuating circumstances that are contributing to your problem.
One last point also in reference to your comment, ">>>private void InitializeComponent()<<< where it initialize all the handles but what if if i don't know the correct handles ?"
The auto-event wire up is just a nicety that VS does to save undo heartache on the developer. Worst case scenario for you is you'll have to just manually (gasp!) create your own
event handler, which could be a benefit for you to do anyway in that it would give you an understanding of the event-driven model of Windows Forms.
A good article to read if you're so inclined is:

Most likely, your problem has already been resolved, but the troubleshooting points above are applicable to a lot of problems that can arise through your development
Better luck in the future,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.