|
-
May 31st, 2006, 03:54 AM
#1
"The TextBox control does not support shortcut keys"
What??? What kind of foolishness is this?
I have a VB.net app where it's true - No shortcut keys work in a textbox (Ctrl+C/X/V etc)
I have a C#.net app where (with shortcutsEnabled=true) Ctrl+C/X/V all work, but Ctrl+A doesnt. Are microsoft lying? half lying? do they know what they are on about?
TextBox is derived from TextBoxBase, which implements the Clipboard functionality..So why would TextBox switch it off again and microsoft say so in msdn (http://msdn2.microsoft.com/en-us/lib...ed(VS.80).aspx)
Further - why disable this useful and integral part of windows functionality in something as basic as a textbox - As far as i know, the you cant set RichTextBox as a design type in the datasources window before you drag something out of it.. so does this mean that all microsoft apps that are databound, that are generated by wizard, lack basic clipboard functionality?
This is so unbelievably.. unbelievable! Does anyone know a solution?
Last edited by cjard; June 30th, 2008 at 04:42 AM.
-
May 31st, 2006, 04:22 AM
#2
Re: "The TextBox control does not support shortcut keys"
Well they say that Ctrl+A is allowed, but I don't see that happening. Instead it just beeps when you press Ctrl+A. It never used to work in VB 6.0 and .NET 1.1, so I had got this solution.
Code:
private bool keyHandled;
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.A)
{
textBox1.SelectAll();
keyHandled = true;
}
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (keyHandled)
{
e.Handled = true;
keyHandled = false;
}
Last edited by Shuja Ali; May 31st, 2006 at 04:39 AM.
Reason: Corrected the code
-
June 15th, 2006, 07:10 AM
#3
Re: "The TextBox control does not support shortcut keys"
can you imagine having to do that for every textbox in an app? this app has over 4000 text boxes on various screens, and only the non-data-bound ones accept Ctrl+C and Ctrl+V. makes me cry!
-
June 15th, 2006, 07:13 AM
#4
Re: "The TextBox control does not support shortcut keys"
It is going to be really tiresome. What you could do is create your own control with all these features and use that.
-
June 16th, 2006, 04:27 PM
#5
Re: "The TextBox control does not support shortcut keys"
Sir/Ma'am this is not such a huge deal. 4,000 text boxes is incredible. I fear the design of this solution was not planned out well. I have seen enterprise solutions designed to intergrate thousands of corporations world-wide and have never seen a solution yet that required that many widgets. May I ask what this solution was designed to do?
However, as Shuja has stated once, all you need to do is create a derived class from the text box class, add the functions you require, and then use this new specialized class.
I would recommend you take a look at an article or book on class inheritance.
Sheesh Larone
Software Engineer, IAS 2006
I just threw back a red bull...what's your excuse? <excellerate speed=3.159> </excellerate>
-
June 16th, 2006, 06:02 PM
#6
Re: "The TextBox control does not support shortcut keys"
I think you missed the point of the post sheesh.
I would never have expected they would break functionality like that...
-
June 16th, 2006, 10:05 PM
#7
Re: "The TextBox control does not support shortcut keys"
Sir, I am sorry about the confusion. I was not intending to be rude. I remeber seeing the following post:
 Originally Posted by cjard
can you imagine having to do that for every textbox in an app? this app has over 4000 text boxes on various screens, and only the non-data-bound ones accept Ctrl+C and Ctrl+V. makes me cry!
I did not need them to cry, it appeared to me that cjard was having an issue with typing the same code over and over again for each of the 4,000 text boxes. So I recommended looking at inheritance, but I see in cjard's signature a post has already been done for inheritance.
I still am suprized at how many text boxes that solution has. I was not trying to be rude about the design of his/her solution I was just shocked at how many text boxes were used.
I am sorry about sounding so rude. I am not always have the correct answer but I will try to post if I think I understand what is the problem.
Last edited by Sheesh; June 16th, 2006 at 10:13 PM.
Reason: I didn't want to click the button.
Sheesh Larone
Software Engineer, IAS 2006
I just threw back a red bull...what's your excuse? <excellerate speed=3.159> </excellerate>
-
June 17th, 2006, 12:01 AM
#8
Re: "The TextBox control does not support shortcut keys"
I've worked on products that easily had that many textboxes. the whole thing took around an hour just to build (not including code analysis & automated testing).
good thing projects like that have more than 1 developer.
-
June 17th, 2006, 12:38 AM
#9
Re: "The TextBox control does not support shortcut keys"
Wow that is incredible.
I guess I have just never had the need for such an amount of text boxes. Most of my designs are for ATM machines, resturant machines (for Taco Bell, Pizza Hut and KFC) and a POS system (for Wal-Mart) and now working on various systems for simulators for NASA to train their captians in flying. In those projects I have never needed many text boxes.
When the day comes I need that many text boxes I will cry too.
Sheesh Larone
Software Engineer, IAS 2006
I just threw back a red bull...what's your excuse? <excellerate speed=3.159> </excellerate>
-
January 22nd, 2007, 01:02 PM
#10
Re: "The TextBox control does not support shortcut keys"
You might have an MDI Parent form or a menu with an Item that has assigned the Ctrl-A combination.
-
February 16th, 2011, 09:03 AM
#11
Re: "The TextBox control does not support shortcut keys"
mmmmmmMICROSOOOOOOOOOOFT!!! (ala Wrath of Khan)
A Custom Control is the ideal solution if you designed it to use it to begin with. Now that you're already using the standard TextBox, how do you go about in an automated way converting all your standard TextBox's to your custom TextBox? For 4 k of them, that is a non-trivial, labor-intensive error-prone task.
You might be able to doe it with advanced Find & Replace, but that's still error-prone.
Another option would be to programmatically, at app startup, attach a KeyDown Event Handler that handles the desired Keys to all Controls of Type "TextBox" in all Forms by recursing through the Controls Collection starting with your Main Form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|