I am having a problem with the "escape" character \e. This code is in my
Windows form KeyPress event. The compiler gives me "unrecognized escape
sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e')
{
this.Close();
} 15 18270
Hi,
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com... I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Weird, here happens the same, it said it's not recignized, even when MSND
says it's valid.
Workaround: just use the value:
if e.KeyChar == (char)27 )
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Thanks for the reply Ignacio. That's what I ended up doing.
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com...I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Weird, here happens the same, it said it's not recignized, even when MSND says it's valid.
Workaround: just use the value: if e.KeyChar == (char)27 ) -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
Where is this in MSDN?
I'm looking at C# language reference - "2.4.4.4 Character literals"
and here are the escape codes:
\' \" \\ \0 \a \b \f \n \r \t \v
I don't see \e. What is it anyways?
--
Stoitcho Goutsev (100)
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com... Thanks for the reply Ignacio. That's what I ended up doing.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com... >I am having a problem with the "escape" character \e. This code is in my > Windows form KeyPress event. The compiler gives me "unrecognized escape > sequence" even though this is documented in MSDN. Any idea if this is a > bug? > > if (e.KeyChar == '\e') > { > this.Close(); > }
Weird, here happens the same, it said it's not recignized, even when MSND says it's valid.
Workaround: just use the value: if e.KeyChar == (char)27 ) -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0])
{
this.Close();
}
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com... I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Of course this will work. Putting @ infront of a string means that you are
not going to use escape sequences, so your string contains two characters -
\ and e.
sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this
esc char must be.
--
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message
news:u3**************@TK2MSFTNGP09.phx.gbl... this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0]) { this.Close(); }
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com...I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Hello,
The actual escape sequence characters are as follows...
\b
Matches a backspace
\t
Matches a tab
\r
Matches a carriage return
\v
Matches a vertical tab
\f
Matches a form feed
\n
Matches a new line
\e
Matches an escape
\040
Matches an ASCII character as octal (up to three digits);
\x20
Matches an ASCII character using hexadecimal representation (exactly
two digits).
\cC
Matches an ASCII control character; for example, \cC is control-C.
\u0020
Matches a Unicode character using hexadecimal representation (exactly
four digits).
Regards
Scott Blood
C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl... Of course this will work. Putting @ infront of a string means that you are not going to use escape sequences, so your string contains two characters - \ and e. sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this esc char must be. --
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:u3**************@TK2MSFTNGP09.phx.gbl... this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0]) { this.Close(); }
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com...I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Again, can somebody point me to the place in the docs where this \e is
mentioned because the set of esc chars that I posted came from the C#
specifications and I don't know more reliable source.
Scott, where did you get that list from?
--
Stoitcho Goutsev (100)
"scott blood" <sc*********@hotmail.com> wrote in message
news:Og**************@TK2MSFTNGP11.phx.gbl... Hello,
The actual escape sequence characters are as follows...
\b Matches a backspace
\t Matches a tab
\r Matches a carriage return
\v Matches a vertical tab
\f Matches a form feed
\n Matches a new line
\e Matches an escape
\040 Matches an ASCII character as octal (up to three digits);
\x20 Matches an ASCII character using hexadecimal representation (exactly two digits).
\cC Matches an ASCII control character; for example, \cC is control-C.
\u0020 Matches a Unicode character using hexadecimal representation (exactly four digits).
Regards Scott Blood C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl... Of course this will work. Putting @ infront of a string means that you are not going to use escape sequences, so your string contains two characters - \ and e. sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this esc char must be. --
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:u3**************@TK2MSFTNGP09.phx.gbl... this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0]) { this.Close(); }
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com... I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Stoitcho,
I got my list from the following link. www.exforsys.com/content/view/1749/360/
Regards
Scott Blood
C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl... Again, can somebody point me to the place in the docs where this \e is mentioned because the set of esc chars that I posted came from the C# specifications and I don't know more reliable source.
Scott, where did you get that list from?
--
Stoitcho Goutsev (100)
"scott blood" <sc*********@hotmail.com> wrote in message news:Og**************@TK2MSFTNGP11.phx.gbl... Hello,
The actual escape sequence characters are as follows...
\b Matches a backspace
\t Matches a tab
\r Matches a carriage return
\v Matches a vertical tab
\f Matches a form feed
\n Matches a new line
\e Matches an escape
\040 Matches an ASCII character as octal (up to three digits);
\x20 Matches an ASCII character using hexadecimal representation (exactly two digits).
\cC Matches an ASCII control character; for example, \cC is control-C.
\u0020 Matches a Unicode character using hexadecimal representation (exactly four digits).
Regards Scott Blood C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl... Of course this will work. Putting @ infront of a string means that you are not going to use escape sequences, so your string contains two characters - \ and e. sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this esc char must be. --
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:u3**************@TK2MSFTNGP09.phx.gbl... this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0]) { this.Close(); }
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com... >I am having a problem with the "escape" character \e. This code is in >my > Windows form KeyPress event. The compiler gives me "unrecognized > escape > sequence" even though this is documented in MSDN. Any idea if this is > a bug? > > if (e.KeyChar == '\e') > { > this.Close(); > }
HI,
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:ez**************@TK2MSFTNGP14.phx.gbl... Where is this in MSDN? I'm looking at C# language reference - "2.4.4.4 Character literals" and here are the escape codes:
\' \" \\ \0 \a \b \f \n \r \t \v
I don't see \e. What is it anyways?
It's in the ".NET Framework General Reference" ,"Character Escapes" http://msdn.microsoft.com/library/de...terescapes.asp
But it does refer to regex , not to the sequences recognized by the compiler
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
That is regex syntax, not C# string syntax; in C#, that would be "\\e" or
@"\e"
Marc
"scott blood" <sc*********@hotmail.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl... Stoitcho,
I got my list from the following link.
www.exforsys.com/content/view/1749/360/
Regards Scott Blood C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:uo**************@TK2MSFTNGP12.phx.gbl... Again, can somebody point me to the place in the docs where this \e is mentioned because the set of esc chars that I posted came from the C# specifications and I don't know more reliable source.
Scott, where did you get that list from?
--
Stoitcho Goutsev (100)
"scott blood" <sc*********@hotmail.com> wrote in message news:Og**************@TK2MSFTNGP11.phx.gbl... Hello,
The actual escape sequence characters are as follows...
\b Matches a backspace
\t Matches a tab
\r Matches a carriage return
\v Matches a vertical tab
\f Matches a form feed
\n Matches a new line
\e Matches an escape
\040 Matches an ASCII character as octal (up to three digits);
\x20 Matches an ASCII character using hexadecimal representation (exactly two digits).
\cC Matches an ASCII control character; for example, \cC is control-C.
\u0020 Matches a Unicode character using hexadecimal representation (exactly four digits).
Regards Scott Blood C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl... Of course this will work. Putting @ infront of a string means that you are not going to use escape sequences, so your string contains two characters - \ and e. sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this esc char must be. --
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:u3**************@TK2MSFTNGP09.phx.gbl... > this seems to work ok... > > string sCal = @"\e"; > > if (e.KeyChar == sCal.ToCharArray()[0]) > { > this.Close(); > } > > Really weird.. problem > > VJ > > "pkaeowic" <pk******@discussions.microsoft.com> wrote in message > news:8F**********************************@microsof t.com... >>I am having a problem with the "escape" character \e. This code is in >>my >> Windows form KeyPress event. The compiler gives me "unrecognized >> escape >> sequence" even though this is documented in MSDN. Any idea if this is >> a bug? >> >> if (e.KeyChar == '\e') >> { >> this.Close(); >> } > >
Hi,
See my other post here, it comes from a regex help page,
The bad part is that when searched c# "character escape"
site:msdn.microsoft.com the second match is for the error the OP had, the
link in that page (where suppostely tell you the VALID c# chars) takes you
to a page http://msdn.microsoft.com/library/de...terEscapes.asp
where \e is listed
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl... Again, can somebody point me to the place in the docs where this \e is mentioned because the set of esc chars that I posted came from the C# specifications and I don't know more reliable source.
Scott, where did you get that list from?
--
Stoitcho Goutsev (100)
"scott blood" <sc*********@hotmail.com> wrote in message news:Og**************@TK2MSFTNGP11.phx.gbl... Hello,
The actual escape sequence characters are as follows...
\b Matches a backspace
\t Matches a tab
\r Matches a carriage return
\v Matches a vertical tab
\f Matches a form feed
\n Matches a new line
\e Matches an escape
\040 Matches an ASCII character as octal (up to three digits);
\x20 Matches an ASCII character using hexadecimal representation (exactly two digits).
\cC Matches an ASCII control character; for example, \cC is control-C.
\u0020 Matches a Unicode character using hexadecimal representation (exactly four digits).
Regards Scott Blood C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl... Of course this will work. Putting @ infront of a string means that you are not going to use escape sequences, so your string contains two characters - \ and e. sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this esc char must be. --
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:u3**************@TK2MSFTNGP09.phx.gbl... this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0]) { this.Close(); }
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com... >I am having a problem with the "escape" character \e. This code is in >my > Windows form KeyPress event. The compiler gives me "unrecognized > escape > sequence" even though this is documented in MSDN. Any idea if this is > a bug? > > if (e.KeyChar == '\e') > { > this.Close(); > }
Ignacio,
As you correctly stated these are Regular Expression's escape sequences.
They have nothing to do with the C# language.
For example VB.NET, as far as I know, doesn't support escape seqs at all.
We can't just look for any document that just lists escape characters.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uY****************@TK2MSFTNGP12.phx.gbl... Hi,
See my other post here, it comes from a regex help page,
The bad part is that when searched c# "character escape" site:msdn.microsoft.com the second match is for the error the OP had, the link in that page (where suppostely tell you the VALID c# chars) takes you to a page http://msdn.microsoft.com/library/de...terEscapes.asp where \e is listed -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:uo**************@TK2MSFTNGP12.phx.gbl... Again, can somebody point me to the place in the docs where this \e is mentioned because the set of esc chars that I posted came from the C# specifications and I don't know more reliable source.
Scott, where did you get that list from?
--
Stoitcho Goutsev (100)
"scott blood" <sc*********@hotmail.com> wrote in message news:Og**************@TK2MSFTNGP11.phx.gbl... Hello,
The actual escape sequence characters are as follows...
\b Matches a backspace
\t Matches a tab
\r Matches a carriage return
\v Matches a vertical tab
\f Matches a form feed
\n Matches a new line
\e Matches an escape
\040 Matches an ASCII character as octal (up to three digits);
\x20 Matches an ASCII character using hexadecimal representation (exactly two digits).
\cC Matches an ASCII control character; for example, \cC is control-C.
\u0020 Matches a Unicode character using hexadecimal representation (exactly four digits).
Regards Scott Blood C# Developer
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl... Of course this will work. Putting @ infront of a string means that you are not going to use escape sequences, so your string contains two characters - \ and e. sCal.ToCharArray()[0]) returns \ in this case which is not \e, whatever this esc char must be. --
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:u3**************@TK2MSFTNGP09.phx.gbl... > this seems to work ok... > > string sCal = @"\e"; > > if (e.KeyChar == sCal.ToCharArray()[0]) > { > this.Close(); > } > > Really weird.. problem > > VJ > > "pkaeowic" <pk******@discussions.microsoft.com> wrote in message > news:8F**********************************@microsof t.com... >>I am having a problem with the "escape" character \e. This code is in >>my >> Windows form KeyPress event. The compiler gives me "unrecognized >> escape >> sequence" even though this is documented in MSDN. Any idea if this is >> a bug? >> >> if (e.KeyChar == '\e') >> { >> this.Close(); >> } > >
pkaeowic wrote: I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
You should look at doing the following instead:
if (e.KeyChar == (char)Keys.Escape)
{
this.Close();
}
--
Tom Porterfield
I can't find it in MSDN either...
VJ
"vj" <vi********@yahoo.com> wrote in message
news:u3**************@TK2MSFTNGP09.phx.gbl... this seems to work ok...
string sCal = @"\e";
if (e.KeyChar == sCal.ToCharArray()[0]) { this.Close(); }
Really weird.. problem
VJ
"pkaeowic" <pk******@discussions.microsoft.com> wrote in message news:8F**********************************@microsof t.com...I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
Tom that is the better way to do it.
Thanks.
"Tom Porterfield" wrote: pkaeowic wrote: I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug?
if (e.KeyChar == '\e') { this.Close(); }
You should look at doing the following instead:
if (e.KeyChar == (char)Keys.Escape) { this.Close(); }
-- Tom Porterfield This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alden Streeter |
last post by:
Here is the HTML that is being output by my asp page:
<a href='Files/category/computers/bigimages/computers-sub-monitors.jpg'
target='_blank' onMouseOver="window.status='Click for a larger image...
|
by: |
last post by:
Hello, I hope someone will help me or I will have to dive from 11th floor.
Why this --> test = @"Melanie "Jets" Riggs" doesnt work in asp? I need
something like that and I dont know how to make it...
|
by: teachtiro |
last post by:
Hi,
'C' says \ is the escape character to be used when characters are
to be interpreted in an uncommon sense, e.g. \t usage in printf(),
but for printing % through printf(), i have read that %%...
|
by: newsgroupie |
last post by:
Hi Newsgroupies,
Please could someone tell me the escape character for " (double quote)
in a string.Format(...) method as \x22 doesn't work as it comes out as
\" in the result.
i.e....
|
by: Steve |
last post by:
string str ="\"C:\Program Files\Internet Explorer\iexplore.exe\" -nohome"
How can I remove charcter to
string str = ="C:\Program Files\Internet Explorer\iexplore.exe -nohome"
|
by: Jeff S |
last post by:
In a VB.NET code behind module, I build a string for a link that points to a
JavaScript function. The two lines of code below show what is relevant.
PopupLink = "javascript:PopUpWindow(" &...
|
by: zomfgz |
last post by:
I hope someone has a good answer for this stupid question.
I'm trying to connect to my sql server 2008 database and I'm using impersonation within my asp.net 3.5 application
<identity...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| |