?
Solved

Delete key doesn't remove selection in TextBox

Posted on 2005-03-18
8
Medium Priority
?
216 Views
Last Modified: 2008-03-03
Hello, VB Experts.

Though I have quite a bit of experience with other languages, including "VB-classic", I'm rather new to VB.Net.  So I hope that the solution to this problem is obvious.

I have several TextBoxes on a form that seem to behave normally except for the case that there is text selected in the TextBox and I use the <Delete> key.  I expect that the selected text should be deleted, but in fact nothing happens.  

I have looked for a property that might control this behaviour, but cannot see anything that is obvious.  I guess that I could trap the KeyUp event and delete the text in code, but I expect to have hundreds of TextBoxes in this application when I am done, and am not happy about this as a solution.

Is there an easy/obvious fix for this?

Thanks for any suggestions.

0
Comment
Question by:omegaomega
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 8

Expert Comment

by:bman9111
ID: 13576806
that doesn't make sense, is ur key working properly. as long as u have the text selected it should erase the data, unless u have the textbox enabled = false which means u can't type into it either.....


0
 
LVL 8

Expert Comment

by:bman9111
ID: 13576821
u are using microsoft textbox1 right, not an addon or ur own creation..
0
 
LVL 12

Author Comment

by:omegaomega
ID: 13576922
Hello, bman9111,

Yes, the <Delete> key works fine.  (E.g. I can trigger the KeyUp event with it.)  
Yes, it is just a plain vanilla flavoured microsoft TextBox (described as "System.Windows.Forms.TextBox" in the properties window).

By the way, I have no problem deleting selections with the <BackSpace> key.

Cheers,
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Accepted Solution

by:
bman9111 earned 250 total points
ID: 13576998
that's wierd...... did u try creating a new project and seeing what it does.


and u are highlighting all the text and hitting the delete key right???

0
 
LVL 12

Expert Comment

by:laotzi2000
ID: 13577137
is it possible that the textbox does not have focus on it?
0
 
LVL 12

Author Comment

by:omegaomega
ID: 13578417
Hello, bman9111,

No, not until you suggested it.  It was a good suggestion, because I don't have a problem in a trivial project with one Form and one TextBox.  This gives me a place to begin to investigate... but not tonight, (it's late here - GMT+1.)  
Hello, laotzi2000,

No, I'm pretty sure that the control has the focus.  For example, I select the text just before trying to delete it.  The delete key is getting absorbed somewhere.  

Incidently, the form containing the TextBox is an inherited Form.  I tried extending the trivial project bman9111 suggested so that I was working on an inherited form there too, but the delete key continued to work fine in the "semi-trivial" project.

Thanks for your input.  I'll report back after I've investigated the differences.

Cheers,
0
 
LVL 8

Expert Comment

by:bman9111
ID: 13580527
does the textbox have to be a inherited form????? That might be the problem. What I would do is create a new form and copy the components and codes u entered only to that form. Do not copy and paste what vb.net has autogenerated.


The next thing is u could post the whole code here, if u want. I didnt ask before because some people don't like to do that.

0
 
LVL 12

Expert Comment

by:laotzi2000
ID: 13580540
It is quite possible the inherited form has intercepted the [delete] key press.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question