By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,671 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,671 IT Pros & Developers. It's quick & easy.

Can I mimic a btn_Click()?

P: n/a
Hi,

I have an application at work that I've inherited from a former employee.
This app runs on a Windows CE .NET environment on an LCD screen but I don't
think that this is the issue. The app has several buttons on the screen that
are clickable and have event handlers. These work fine. What I did was set
up a UDP link from a PC to the CE device and I want to send commands from my
PC instead of clicking the button on the device. This doesn't work very
well. It works if the action does not affect the display such as testing
LEDs on the device. If I have operations that remove buttons from the screen
and make others appear, the buttons appear to be dead. For example my form
gave me this event hander for the button which works well.

this.m_oCalibrateLCDBtn.Click += new
System.EventHandler(this.CalibrateLCD_Click);

When I receive the remote command from my PC I try to do a similar thing
which isn't working.

CalibrateLCD_Click(this.m_oCalibrateLCDBtn, dummyEventArgs);

I must be missing something from the form that the event handler has but I
don't know what it is. Some other points are: Other remote UDP command are
OK as long as the display is not affected. Once I'm in the
CalibrateLCD_Click() event handler my sender and "this" look OK in my
"Autos" window in both cases. My EventArgs is empty which is why I was able
to create a dummy. However once I start some operations that affect the
display (removing buttons such as setting enabled and visible to false) my
sender and my "this" get clobbered in my "Autos" window. It says "undefined
value". If I try to debug this with breakpoints things get even more messed
up. I had better luck with MessageBox(es) to debug but still am not having
any luck.

If anyone has any ideas on this I would appreciate advice. As I said I don't
I'm mimicking the Event Handler properly. Maybe I'm not supposed to do this
at all.

Rick
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rick,

try: CalibrateLCD.PerformClick()

i.e. btnName.PerformClick()

A handy method I just discovered this week.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.