473,549 Members | 2,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending an "(" with sendkeys

I have a procedure that needs to put characters into the current insertion
point of a textbox. This insertion point is not necessarily the end of the
current string so textbox1.text &= "?" won't do.

I have found that using sendkeys does the trick:

Private Sub UserControl11_b uttonpress(ByVa l text As String) Handles
UserControl11.b uttonpress
System.Windows. Forms.SendKeys. Send(text)
End Sub

However if the parameter "text" happens to be "(" or ")", I get the
following error:

An unhandled exception of type 'System.Argumen tException' occurred in
system.windows. forms.dll
Additional information: Group are delimiters not balanced.

It looks like sendkeys is evaluating (text) rather that simply mimicking a
"(" key press.

There does not appear to be a special sendkeys code for parenthesis and
chr(40 or 41) doesn't work.

How do I handle this special case?
--
mark
Nov 21 '05 #1
3 24407
<mdsn>
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses
() have special meanings to SendKeys. To specify one of these characters,
enclose it within braces ({}). For example, to specify the plus sign, use
"{+}". To specify brace characters, use "{{}" and "{}}". Brackets ([ ]) have
no special meaning to SendKeys, but you must enclose them in braces.
</msdn>

"mark" <ma**@discussio ns.microsoft.co m> wrote in message
news:E6******** *************** ***********@mic rosoft.com...
I have a procedure that needs to put characters into the current insertion
point of a textbox. This insertion point is not necessarily the end of the
current string so textbox1.text &= "?" won't do.

I have found that using sendkeys does the trick:

Private Sub UserControl11_b uttonpress(ByVa l text As String) Handles
UserControl11.b uttonpress
System.Windows. Forms.SendKeys. Send(text)
End Sub

However if the parameter "text" happens to be "(" or ")", I get the
following error:

An unhandled exception of type 'System.Argumen tException' occurred in
system.windows. forms.dll
Additional information: Group are delimiters not balanced.

It looks like sendkeys is evaluating (text) rather that simply mimicking a
"(" key press.

There does not appear to be a special sendkeys code for parenthesis and
chr(40 or 41) doesn't work.

How do I handle this special case?
--
mark
Nov 21 '05 #2

Shiva,

Thank you, you are a wizard.

I have an extensive library of vb.net references, but they don't include
this important level of detail. Can you recommend a reference that does cover
this type of information?


"Shiva" wrote:
<mdsn>
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses
() have special meanings to SendKeys. To specify one of these characters,
enclose it within braces ({}). For example, to specify the plus sign, use
"{+}". To specify brace characters, use "{{}" and "{}}". Brackets ([ ]) have
no special meaning to SendKeys, but you must enclose them in braces.
</msdn>

"mark" <ma**@discussio ns.microsoft.co m> wrote in message
news:E6******** *************** ***********@mic rosoft.com...
I have a procedure that needs to put characters into the current insertion
point of a textbox. This insertion point is not necessarily the end of the
current string so textbox1.text &= "?" won't do.

I have found that using sendkeys does the trick:

Private Sub UserControl11_b uttonpress(ByVa l text As String) Handles
UserControl11.b uttonpress
System.Windows. Forms.SendKeys. Send(text)
End Sub

However if the parameter "text" happens to be "(" or ")", I get the
following error:

An unhandled exception of type 'System.Argumen tException' occurred in
system.windows. forms.dll
Additional information: Group are delimiters not balanced.

It looks like sendkeys is evaluating (text) rather that simply mimicking a
"(" key press.

There does not appear to be a special sendkeys code for parenthesis and
chr(40 or 41) doesn't work.

How do I handle this special case?
--
mark

Nov 21 '05 #3
Mark,

MSDN (online or the locally installable library) is the ultimate resource
for this type of documentation details. In fact, .NET SDK and Visual Studio
..NET themselves come with full .NET class library documentation.

Hope that helps.

"mark" <ma**@discussio ns.microsoft.co m> wrote in message
news:45******** *************** ***********@mic rosoft.com...

Shiva,

Thank you, you are a wizard.

I have an extensive library of vb.net references, but they don't include
this important level of detail. Can you recommend a reference that does
cover
this type of information?


"Shiva" wrote:
<mdsn>
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses
() have special meanings to SendKeys. To specify one of these characters,
enclose it within braces ({}). For example, to specify the plus sign, use
"{+}". To specify brace characters, use "{{}" and "{}}". Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces.
</msdn>

"mark" <ma**@discussio ns.microsoft.co m> wrote in message
news:E6******** *************** ***********@mic rosoft.com...
I have a procedure that needs to put characters into the current insertion
point of a textbox. This insertion point is not necessarily the end of the
current string so textbox1.text &= "?" won't do.

I have found that using sendkeys does the trick:

Private Sub UserControl11_b uttonpress(ByVa l text As String) Handles
UserControl11.b uttonpress
System.Windows. Forms.SendKeys. Send(text)
End Sub

However if the parameter "text" happens to be "(" or ")", I get the
following error:

An unhandled exception of type 'System.Argumen tException' occurred in
system.windows. forms.dll
Additional information: Group are delimiters not balanced.

It looks like sendkeys is evaluating (text) rather that simply mimicking a
"(" key press.

There does not appear to be a special sendkeys code for parenthesis and
chr(40 or 41) doesn't work.

How do I handle this special case?
--
mark

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
460
by: Mr. Bungle | last post by:
I would like to send email automatically via a command button. I have accomplished this just fine through the following code: (Outlook should already be open for reliable results) Private Sub Command6_Click() ReturnValue = Shell("Outlook.EXE", 1) ' Run Outlook SendKeys "%(F)", True SendKeys "W", True SendKeys "M", True ...
1
27199
by: GrantS | last post by:
I need to use a sendkeys key combination to automate the "accept files" that a remote user wants to send to me via Windows messenger. I am using automation to work with Windows Messenger client in a Winforms C# application. I have tried a number of code segment combinations for ALT T combination without success. The combinations might be...
6
31011
by: Gary | last post by:
Hi, I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)") This is not working ..what could be the reason..?
5
10453
by: Pete | last post by:
I'm trying to use SendKeys to send a 'close' key sequence to an application popup. Unfortunately, I'm running into the classic timing issues with SendKeys at it sometimes hits the wrong app (even though I'm using AppActivate). Is there a more intelligent way of sending keystrokes to a specifies window, maybe using the class id instaed of...
2
11591
by: David Kanter | last post by:
Hi, I am relatively inexperienced with VB.Net, but I am familiar with many concepts from programming; I have some basic level of competence with C/C++ and Perl, but I just started using VB this morning. I am trying to write an .exe file that is essentially a script. It will open an application, send it some commands via the keyboard,...
2
2411
by: Phil Galey | last post by:
I have an application written in VB.NET, running on Windows 2000 SP 3. It uses a process object and AppActivate, followed by SendKeys commands, to control a running QuarkXPress application. On the development workstation, it works fine; however on the target workstation, SendKeys fails. Both workstations are Windows 2000 SP3 and both have...
0
1670
by: pigge79 | last post by:
Hi there, I've developing an application that translates keystrokes sent from my TV card remote control to Windows XP Media Center, since the two are not compatible. I've successfully been able to use System.Windows.Forms.SendKeys.Send to send keypresses to Windows XP Media Center, except for the backspace character that I need when...
5
12997
by: =?Utf-8?B?U3JpbWFu?= | last post by:
Hi, We are launching .net window from vb6 form. In .net form tabbing(tab out from one control to another control) was not working. for that i have written a code like Sendkeys.send("{TAB}") in the textbox keypress event. I got the following error msg: {"SendKeys cannot run inside this application because the application is not handling...
0
1564
by: jairathore | last post by:
Hi, I m working on a project on which my requirment is like that remotely i control another application by using sendkey.sendwait method, i m sending some keystroke to that application and execute this application like. To run that application some shorcut key is there SendKeys.SendWait("(%)rs"); ...
0
7480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7751
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7992
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7840
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5396
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5119
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1087
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.