[dba-VB] ControlChars in C#

jwcolby jwcolby at colbyconsulting.com
Tue Mar 25 10:11:30 CDT 2008

I have to tell you Gustav, I feel the same way about working in the query
editor in SQL Server.  Here we are in 2008, using one of the most powerful
database engines in the world and the user interface reminds me of 1984.  We
do have color coding of keywords, but that is about as far as we get.  As a
language and an environment, Turbo Pascal was heads and shoulders above the
working environment of SQL Server. 


"Real men don't need no stinkin' editor."

John W. Colby
Colby Consulting
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, March 25, 2008 10:56 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] ControlChars in C#

Hi all

I can't believe this:


In Visual Basic you have a nice class ControlChars where you, for example,
ControlChars.Back for the BackSpace character.
In C# you have to write ugly (char)8 or '\b' in stone age C++ style.

So I have to write all this code to avoid the beep after pressing Enter in
the small navigator position field of the record navigation toolbar while
still be able to edit the record number with both the Delete and the
BackSpace keys:

        private void bindingNavigatorPositionItem_KeyPress(object sender,
KeyPressEventArgs e)
            char c = e.KeyChar;
            if (Char.IsControl(c))
                if (c != (char)8) 
                    e.Handled = true;

What do you do? Live with the beep or run your own homebuilt ControlChars?


dba-VB mailing list
dba-VB at databaseadvisors.com

More information about the dba-VB mailing list