Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 27th, 2003, 02:37 PM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default usercontrols and delete keypress

I'm creating a modified textbox and want to intercept the delete key. As a starting point I used the numeric-only Textbox example given on pages 438-441 of [u]Professional VB.Net 2nd ed.</u>

I am able to write code that handles the backspace key without any problem, but not the delete key.

If I add a line at the top of the keypress eventhandler to write the key pressed to the output window, the delete key does not register as a keypress, however the textbox behaves correctly (deleting the character to the right of the cursor.) Pressing alphanumeric keys and the backspace key result in the appropriate value being printed in the output window and in the textbox (if it is one I'm not discarding.)

Does vb.net handle the delete key as a keypress event?

As I want to set some properties of the control based upon the contents of the textbox, I want to be able to update the properties when the user alters the text by repositioning the cursor and then deleting text to the right of the cursor.

Ideally, I'd like to know when the user has pressed the delete key so I can check if deleting the character to the right will require a change in one of the controls properties.

Can this be done easily starting from the textbook example or am I going to have to adopt a different approach?

 
Old November 28th, 2003, 05:40 AM
Authorized User
 
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

The keypress event will trap ASCII characters, to trap other non ASCII keys use the keyup or keydown event and trap the keycode. I think these keys all have friendly names like vbkeyreturn.

HTH

Duncan
 
Old December 22nd, 2006, 07:19 PM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

found this with google. thanks a lot!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Usercontrols yveerabhadrarao ADO.NET 1 August 3rd, 2007 06:57 AM
Javascript in UserControls chakravarthy_vb Classic ASP Components 1 March 30th, 2005 06:35 AM
Linking UserControls dhanyavnair Pro VB 6 2 December 1st, 2004 02:41 PM
Postback for usercontrols anuradha80 General .NET 4 September 27th, 2004 11:35 PM
Reusability of UserControls jara VS.NET 2002/2003 0 August 14th, 2003 05:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.