omegaomega
asked on
Delete key doesn't remove selection in TextBox
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.
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.
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.....
u are using microsoft textbox1 right, not an addon or ur own creation..
ASKER
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.Text Box" in the properties window).
By the way, I have no problem deleting selections with the <BackSpace> key.
Cheers,
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.Text
By the way, I have no problem deleting selections with the <BackSpace> key.
Cheers,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
is it possible that the textbox does not have focus on it?
ASKER
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,
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,
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.
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.
It is quite possible the inherited form has intercepted the [delete] key press.