We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Causing events to fire

Thread ID:




2351 Jan 10,2003 06:53 PM UTC WinForms 0
Tags: FAQ
Asked On January 10, 2003 06:53 PM UTC

Does anyone know how to cause events for controls to fire without using the UI? I'm trying to write some unit tests for my winforms, making sure they do the correct things, but I don't know how to make the event fire generally. There is a PerformClick function on menu items and buttons which works for these cases, but I'm looking for something a bit more general. Also, I'm having a problem with PerformClick as well. It seems the event processing is synchronous here, so if my event handler calls ShowDialog on a form, then the dialog appears and the test waits until the dialog is closed. What I'd like to do is have the dialog get started on a different thread (which would also have the message pump) so my test thread could then find the dialog form and manipulate it then close it. Does anyone know of a way to do this?


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon