all groups > dotnet windows forms > february 2005 >
You're in the

dotnet windows forms

group:

How to create an click event in a form automatic(C#)



Re: How to create an click event in a form automatic(C#) Herfried K. Wagner [MVP]
2/14/2005 4:48:55 PM
dotnet windows forms: "Baboon" <woshimqw@hotmail.com> schrieb:
[quoted text, click to view]

Select the form/control and click the small lightning button in the
properties window. Choose the desired event and add a handler.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
How to create an click event in a form automatic(C#) Baboon
2/14/2005 10:53:09 PM
Hello

Now i have try create an click event in a form,so i doubleclick the form,but
the IDE create an form_load event automatic:

private void Form2_Load(object sender, System.EventArgs e)
{ }

but the code i need is:

private void Form2_Click(object sender, System.EventArgs e)
{ }

so i had write it by hand,but it not work,i find some books,and add some
codes:

this.Click += new System.EventHandler(this.Form2_Click);

Haha,it work,but how can IDE create an click event automatic,not with
handwrite?

Re: How to create an click event in a form automatic(C#) Baboon
2/15/2005 12:44:04 AM
Thanks you answer! But it doesn't work correct.

I click the lightning button ,it take me to the event's load,what is show me
is an empty combBox,i write an event "Form_Click",push enter ,the IDE create
code:
private void Form1_Click(object sender, System.EventArgs e)
{

}
and other code in InitializeComponent:
this.Load += new System.EventHandler(this.Form1_Click);

then i complet the code,push F5,debug it .
Now something which i hope to happen when i click done already,it happen
when the form load,so i change the code:
this.Load += new System.EventHandler(this.Form1_Click);
to:
this.Click += new System.EventHandler(this.Form1_Click);
then the program done with my wish.

It's so interesting,i don't know why?
Don't tell me i need to format the c:/ and install the VS again,it not a
good idea!







Re: How to create an click event in a form automatic(C#) Christian Wilhelm
2/15/2005 11:20:11 AM
Hi Baboon,

just double-klick in the comboBox of the desired event then vs.net will
create the code pattern for you automatically.

Sincerly,
Christian


"Baboon" <woshimqw@hotmail.com> schrieb im Newsbeitrag
news:ODplsRrEFHA.3728@TK2MSFTNGP14.phx.gbl...
[quoted text, click to view]

Re: How to create an click event in a form automatic(C#) Baboon
2/15/2005 10:15:38 PM
Thanks very much!
I find the correct comboBox,and it done with my wishes.
Thanks again!!!

AddThis Social Bookmark Button