hi
can any one help me
i am getting fallowing error in windows application.
SendKeys cannot run inside this application because the application is not handling Windows messages. Either change the application to handle messages, or use the SendKeys.SendWait method
Loading
Sunny SharmaPosted Jul 3, 2013, 5:55 AM
I've attached a sample application for you to make you believe that this code works just fine, give it a check and confirm. May be there's is something else in your code that is causing the error.
Happy Coding :)
Mark it as answer if it helps.
Cheers!
venkata kumarPosted Jul 4, 2013, 5:15 AM
i created one text box custom control.
in that i created my own properties for tex tbox.
that text box i am using other application.
Sunny SharmaPosted Jul 4, 2013, 2:02 AM
I'm not being so clear on your this point:
"i create one textbox
that textbox i am using other windows application
by adding dll"
can you please explain a bit more or share your project?
venkata kumarPosted Jul 4, 2013, 1:25 AM
thank you
i create one textbox
that textbox i am using other windows application
by adding dll
there i am getting this error.
SendKeys cannot run inside this application because the application is not handling Windows messages. Either change the application to handle messages, or use the SendKeys.SendWait method.
a).when i open form by using : frm.showdialog();
form is opening
when i click on enter key in text box.i am not getting any error
b).when i open form by using: frm.show();
form is opening
when i click on enter key in text box.i am getting any error
venkata kumarPosted Jul 3, 2013, 12:21 AM
i am given already _btabwithenterkey is true
check my fallowing code:
protected bool _bTabwithEnterKey = true;
[Category("New Properties"),
Description("Indicates whether the user can use the ENTER key Instead of TAB key " +
"to give focus to the next control."),
DefaultValue(true)]
public bool TabwithEnterKey
{
get { return _bTabwithEnterKey; }
set { _bTabwithEnterKey = value; }
}
protected void MaedhaatextBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.Enter && _bTabwithEnterKey)
{
dynamic _obj = sender;
if (_obj.AccessibleName != "PRIMARYKEY")
// this.GetNextControl((Control)sender, true).Focus();
System.Windows.Forms.SendKeys.Send("{TAB}");
}
}
Sunny SharmaPosted Jul 2, 2013, 1:07 AM
You code is working just fine. I gave it a try on a form having three text boxes and I placed your code for first text box's KeyDown event. Since i couldn't figure out what is "_bTabwithEnterKey", so I just replaced with a true and it's working like a charm. When I hit enter key it sends the Tab Key signal and the cursor moves to the second text box.
May be some other glitch is there in your rest of the code. I suggest you check them carefully.
Happy Coding :)
Cheers!
venkata kumarPosted Jul 2, 2013, 12:09 AM
thank you for reply sunny
this is my code
protected void MaedhaatextBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.Enter && _bTabwithEnterKey)
{
dynamic _obj = sender;
if (_obj.AccessibleName != "PRIMARYKEY")
System.Windows.Forms.SendKeys.Send("{TAB}");
}
}
Sunny SharmaPosted Jul 1, 2013, 12:41 AM
Is that a Win Forms app or a Console one?
Show us your code which is causing the problem to occur.