Solved

Send key strokes to control

Posted on 2014-09-02
1
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Securing WEBAPI on Azure 2 54
SQL Server Serialization error 8 42
Health check of winows and webservces 5 48
Datagridview column resizing 8 22
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decadeā€¦

738 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