?
Solved

Delete key doesn't remove selection in TextBox

Posted on 2005-03-18
8
Medium Priority
?
221 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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

569 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