samsmithnz Posted August 23, 2004 Posted August 23, 2004 This is a quick and easy one: How do I catch the Ctrl + A key combination? I'm trying to programmatically select all text in a richtextbox.... Quote Thanks Sam http://www.samsmith.co.nz
Administrators PlausiblyDamp Posted August 23, 2004 Administrators Posted August 23, 2004 Private Sub RichTextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyUp If e.Control = True AndAlso e.KeyCode = Keys.A Then End If End Sub Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Arch4ngel Posted August 23, 2004 Posted August 23, 2004 What are you... Why are you trying to do that ? This function is already implemented inside RichTextBox component. Maybe I'm just sleepy... or I'm simply crazy... but I don't understand what you are trying to do. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
samsmithnz Posted August 24, 2004 Author Posted August 24, 2004 EDIT: I'm using a third party control, which seems to have broken this functionality. I think I'm gonig to log a bug report. Quote Thanks Sam http://www.samsmith.co.nz
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 if your richtextTextBox has the focus... do CTRL-A and everything will be selected. Else... if you want to do it "manually"... richTextBox1.SelectAll() [edit]thanks for removing all the answered post... now mine mean nothing :p lol[/edit] Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
samsmithnz Posted August 24, 2004 Author Posted August 24, 2004 Sorry :). I thought it was weird at first and then just assumed that it was because I'd taken for granted the functionality in IE (I've been working most in ASP.NET for the past 6 months you see). I'll try the manual method anyway as a temp workaround. Quote Thanks Sam http://www.samsmith.co.nz
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 Confirm me that you are working with WinForm and not with ASP.NET please. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
samsmithnz Posted August 24, 2004 Author Posted August 24, 2004 Yes working with Windows forms. I was jsut saying that I thought it might have not been built into windows controls. Quote Thanks Sam http://www.samsmith.co.nz
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 I think that if it's third party ... he must have overriden keyboard input. You might scan the Controls collection of your third party and find your richtextbox component. if it's directly derived from... well.. you'll be able to use RichTextBox1.SelectAll() Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.