Click here to Skip to main content
15,909,591 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi From my project in C#, I can open a dial up connection which I have made before.
I want the button "connect" pressed without pressing the enter button.
How can I do that in a simple way?
may be it's like virtual keyboard!
Tnx anyway
Posted
Updated 16-Aug-13 21:54pm
v2

That depends on your criteria how you want to press that button and under which condition.You can automate enter button button by using..
C#
SendKeys.Send("{ENTER}");

Or,programmatically press that button like:
C#
connectButton.PerformClick();

Also see..
How to: Call a Button's Click Event Programmatically[^]
 
Share this answer
 
Comments
Behno0o0oD 17-Aug-13 4:40am    
I think this class is not in CompactFramework. is it?
ridoy 17-Aug-13 4:43am    
which,SendKeys ? still it is possible to do SendKeys like work in CompactFramework though SendKeys is not directly supported by it.Then you can look alternate PerformClick() option.
C#
[DllImport("coredll.dll", SetLastError = true)]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);

C#
byte VK_TAB = 0x09;
const int KEYEVENTF_KEYUP = 0x2;
const int KEYEVENTF_KEYDOWN = 0x0;
keybd_event(VK_TAB, 0, KEYEVENTF_KEYDOWN, 0);
keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900