Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Interface and Graphics > Allow only delete in textbox


Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2004, 01:54 PM
oralb5 oralb5 is offline
Regular
 
Join Date: Jun 2004
Posts: 82
Default Allow only delete in textbox


I have some textboxes which I made read-only, however can be populated using the calendar control. The point is that i don't want the end users to type in the wrong date by accident but rather use the calendar control.

While I was looking at it, I wondered if a user wanted to delete what he entered, could he since it is read-only?

Any ideas?
Reply With Quote
  #2  
Old 08-03-2004, 07:37 PM
bear24rw's Avatar
bear24rw bear24rw is offline
Contributor
 
Join Date: May 2004
Location: NJ
Posts: 477
Default

do you want to clear the whole textbox?

if thats so then you could, under the textboxs Key down event, check if the user clicked the delete key
Code:
Private Sub txtName_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtName.KeyDown If e.KeyCode = Keys.Delete Then txtbox.Text = Nothing End If End Sub
Is that what you mean, or do you have multipul dates in one textbox and you only want to delete the last one entered?
Edit: hmmm... it doesnt seemt o work with the delete key but it works with others, can anyone explain this?

Edit: oh, delete is for the DEL key not the backspace anyways just change it to 'back' instead

Last edited by bear24rw; 08-03-2004 at 07:43 PM.
Reply With Quote
  #3  
Old 08-04-2004, 10:21 AM
oralb5 oralb5 is offline
Regular
 
Join Date: Jun 2004
Posts: 82
Default

This is exactly what I was asking about. Thanks.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->