Solved

Send key strokes to control

Posted on 2014-09-02
1
210 Views
Last Modified: 2014-09-02
I have a WinForm laid out as a keyboard.  This form gets shown as a dialog when I Enter certain controls on a another form.

I pass references to both the parent form, and the actual control to the keyboard form, with the intention of programatically send key stroke to the control.

I tried using the contro.SelectedText = "x" approach, and that works great for the text or pure integer controls, but it doesn't work on decimal or currency type fields.  

So recently I have been looking at SendKeys.Send(), and even PostMessage(), but in both cases, whilst the code appears to run, nothing appears in the control.

Now I would have thought it would be pretty easy to send keystrokes to a control, when you already have a reference to that control, but this problem eludes me.

Can anyone suggest a simple foolproof way to do this.

Thanks
0
Comment
Question by:townsma
1 Comment
 
LVL 6

Accepted Solution

by:
townsma earned 0 total points
ID: 40300325
I have found the solution, turns out, as I half expected, to be really easy.  The controls have the Handle parameter, I just used this handle with the PostMessage method.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question