JadeWolf324 Posted July 19, 2004 Share Posted July 19, 2004 i am trying to figure out how to do this.. in VB6 it was: KeyAscii = Asc(UCase$(Chr$(KeyAscii))) also...how do i make shortcut keys work? so like Ctrl+A = Select all text. Link to comment Share on other sites More sharing options...
0 Steven Posted July 19, 2004 Share Posted July 19, 2004 (edited) There is a method called ".SelectAll()". Create a Menu. Call it "Select All". Add a Shortcut Key to it CTRL+A from the properites pane. Code the menu. Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click TextBox1.SelectAll() End Sub The above code will execute when the "Select All" menu is selected or when the user presses CTRL+A. The outcome of this code will select all the text in the textbox in the picture. :) Edited July 19, 2004 by xStainDx Link to comment Share on other sites More sharing options...
0 bangbang023 Veteran Posted July 19, 2004 Veteran Share Posted July 19, 2004 this is the code i use for textbox named txtnote: Private Sub txtNote_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtNote.KeyDown If e.KeyCode = Keys.A AndAlso e.Modifiers = Keys.Control Then txtNote.SelectAll() End If End Sub Link to comment Share on other sites More sharing options...
0 JadeWolf324 Posted July 19, 2004 Author Share Posted July 19, 2004 what about if i have multiple fields...how do i make it know which to do it to? Link to comment Share on other sites More sharing options...
0 JadeWolf324 Posted July 19, 2004 Author Share Posted July 19, 2004 this is the code i use for textbox named txtnote: Private Sub txtNote_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtNote.KeyDown If e.KeyCode = Keys.A AndAlso e.Modifiers = Keys.Control Then txtNote.SelectAll() End If End Sub that did nothing... :( Link to comment Share on other sites More sharing options...
0 bangbang023 Veteran Posted July 19, 2004 Veteran Share Posted July 19, 2004 that did nothing... :( if you have the textbox active and have replaced txtnote with the name of your textbox, it will select all the text. That's wha tto code does since that's what you asked. I know it works, I use it in NexNote. Link to comment Share on other sites More sharing options...
0 JadeWolf324 Posted July 19, 2004 Author Share Posted July 19, 2004 if you have the textbox active and have replaced txtnote with the name of your textbox, it will select all the text. That's wha tto code does since that's what you asked. I know it works, I use it in NexNote. the reason it didnt work is because ctrl A was being reserved. it DOES work..except it does a beep() everytime you select all... Link to comment Share on other sites More sharing options...
0 bangbang023 Veteran Posted July 19, 2004 Veteran Share Posted July 19, 2004 reserved for what? use another shortcut then. Link to comment Share on other sites More sharing options...
0 JadeWolf324 Posted July 19, 2004 Author Share Posted July 19, 2004 reserved for what? use another shortcut then. yes yes..it works now..but now it beeps every time i use it. Link to comment Share on other sites More sharing options...
0 bangbang023 Veteran Posted July 19, 2004 Veteran Share Posted July 19, 2004 yes yes..it works now..but now it beeps every time i use it. Well it shouldn't. Use a different combination then. Link to comment Share on other sites More sharing options...
0 DrZoidberg Posted July 19, 2004 Share Posted July 19, 2004 For capitalization, look at the "CharacterCasing" property of the WinForms text box control. You can set it from within the Windows Forms designer. The "ActiveControl" property of the "Form" class will tell you what the active control (if any) is on a form. It's a fairly trivial matter to check whether this is a text box and if so, to select the contents of that text box. Link to comment Share on other sites More sharing options...
Question
JadeWolf324
i am trying to figure out how to do this..
in VB6 it was:
also...how do i make shortcut keys work? so like Ctrl+A = Select all text.
Link to comment
Share on other sites
10 answers to this question
Recommended Posts