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 / August 2006

Tip: Looking for answers? Try searching our database.

Simulating events. Calling Click on a button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pieter Breed - 04 Aug 2006 09:43 GMT
Hi,

I would like to simulate UI events on UI controls. For example, I would
like to make a button control think its been Clicked (from an outside
class), so it would go through the click animation, raise the
associated events etc.

Is there a way to do this?

Regards,
Pieter
Joanna Carter [TeamB] - 04 Aug 2006 09:56 GMT
| I would like to simulate UI events on UI controls. For example, I would
| like to make a button control think its been Clicked (from an outside
| class), so it would go through the click animation, raise the
| associated events etc.
|
| Is there a way to do this?

Why not separate out the code into another method and call that method from
the Click event, then you can call the separate method from other code ?

 public partial class Form1 : Form
 {
   public void MyMethod()
   {
     // do stuff
   }

   private void button1_Click(object sender, EventArgs args)
   {
     MyMethod();
   }
 }

Joanna

Signature

Joanna Carter [TeamB]
Consultant Software Engineer

Trevor Benedict R - 05 Aug 2006 19:21 GMT
Checkout the PerformClick Method.

Regards,

Trevor Benedict R

> Hi,
>
[quoted text clipped - 7 lines]
> Regards,
> Pieter
Pieter Breed - 07 Aug 2006 05:53 GMT
Thanks Trevor, this is exactly what I had in mind...

pieter

> Checkout the PerformClick Method.
>
[quoted text clipped - 13 lines]
> > Regards,
> > Pieter

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.