Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Baboon - 14 Feb 2005 14:53 GMT
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?
Herfried K. Wagner [MVP] - 14 Feb 2005 15:48 GMT
"Baboon" <woshimqw@hotmail.com> schrieb:
> 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:

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

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

Baboon - 14 Feb 2005 16:44 GMT
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!
Christian Wilhelm - 15 Feb 2005 10:20 GMT
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

> Thanks you answer! But it doesn't work correct.
>
[quoted text clipped - 19 lines]
> Don't tell me i need to format the c:/ and install the VS again,it not a
> good idea!
Baboon - 15 Feb 2005 14:15 GMT
Thanks very much!
I find the correct comboBox,and it done with my wishes.
Thanks again!!!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.