I need some help when it comes to adding functions in C#...

In VB.net you can simply add a new function that deals with a specific action of a form object by clicking on the following drop down menu...


When I go to the menu in C# all i get is this


So lets say I wanted to add a function for when the text box in C# is clicked, how would I go about doing this, do I need to edit the form designer code?

Sorry in advanced for small pictures but I think I get the idea across


you either code it in by hand, or, select the event in the properties window and double click on the area where it would list the event and it makes it and links it for you

In vc#, when you start a method (by typing a period "."), it will automatically pop up ALL the methods known. Start typing which one you want and it will go to it, hit enter to accept the right one, or just type it all out. Or just scroll down (you can use arrow keys if you want), and click on the one you want and it will place it there.

to add a function to an item on your form window it really depends on what function you need it to do. There are a few ways to get to that point.

1) As Lizr said on the form design windows (the screen you add the items to), you right click the item you want to add a function to and modify it's event.

2) Double click the item will allow you to work with the function, the drawback here is it automatically creates a "On_click" event, so unless you want that then this way is not the way to go.

3) Click the tab on top labeled Form1.cs (not sure what program you're using for C#, but I'm using VS2008 Pro)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.