Peter N Roth

When I have a button on a form, and I double-click the button, the IDE generates a handler method Name_ButtonClick if it doesnĄ¯t already exist, and then transfers me to that method.


Where is the template for _ButtonClick I assumed it was a snippet, but I canĄ¯t find it.




Re: Visual C# IDE Code Generator for methods

Chris Brandsma

As far as I know there isn't one. The editor is just generating a stub.

Is there something spesific you are trying to do





Re: Visual C# IDE Code Generator for methods

BabyFace Jay

I think you want to edit the template for the buttonClick stub By clicking Tools, then Code Snippets Manager, I don't really see it so I think there is no way to change the template for it.





Re: Visual C# IDE Code Generator for methods

Peter N Roth

Of course!

I want to change the formatting. i want an extra blank line and then a line of this
//==================================================
at the beginning of the inserted stub.





Re: Visual C# IDE Code Generator for methods

Chris Brandsma

I dont think there is a way to do that.

I realise I'm thrashing all over what is a personal coding style...

But if you type /// in your editor you automatically get:

Code Snippet

/// <summary>

///

/// </summary>

Is that good enough Otherwise you could create a code snippet so that after you create your new stub, you can type a few characters and a tab and it gets added automaticaly. Sorry, but that is the best I can think of.






Re: Visual C# IDE Code Generator for methods

BabyFace Jay

How about creating a snippet that creates the whole structure of a button click event plus those extra formatting that you want, its almost the same i think ha... den you just add the event to the button.Click





Re: Visual C# IDE Code Generator for methods

Peter N Roth

I appreciate the /// idea, but I donĄ¯t want to have to enter any more keystrokes ¨C the machine can, and should do the work.


This isnĄ¯t a snippet issue, although I wish it were.






Re: Visual C# IDE Code Generator for methods

Citizen on the earth

Hello Peter,

As I understand, you would like VC# IDE to insert some comments to the event handler automatically such as "///" above it or "//============" in it.


As far as I know, there is no such a feature in Visual C# IDE and you can try code snippet which is similar to what you need.

Citizens on the earth





Re: Visual C# IDE Code Generator for methods

Chris Brandsma

Nope, sorry. Your going to have to have to do the work to get that one.

Really, the code snippet is your best answer. It isn't automatic, but it is as close as you are going to get.