473,385 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Delete Key behavior

I've converted my VB6 app to VB.NET 2003. For some strange reason, the delete
key will not work in any of my textboxes in the application. The backspace
key works just fine. The delete key works in textboxes in VB6. Is there some
new event that I need to code for the delete key in VB.NET?
Aug 21 '06 #1
6 9490
Hi Joemanc,

Are you processing text in a textbox using the KeyPress event? If so, not
that the delete key does not appear in this event, but you can trap it in
KeyUp/KeyDown.

On Mon, 21 Aug 2006 20:43:01 +0200, Joemanc <jm****@cl-law.com.donotspam>
wrote:
I've converted my VB6 app to VB.NET 2003. For some strange reason, the
delete
key will not work in any of my textboxes in the application. The
backspace
key works just fine. The delete key works in textboxes in VB6. Is there
some
new event that I need to code for the delete key in VB.NET?


--
Happy Coding!
Morten Wennevik [C# MVP]
Aug 22 '06 #2
Morten - I am not not using the KeyPress event. Am I now required to trap the
Delete keypress in .NET? Seems odd that I would have to trap the Delete
keypress keypress, but not the backspace key.

Oddly enough, I discovered in one of my application's smaller forms, the
delete button works. I double-checked the properties of the different
textboxes and the different forms and could not find any differences.

"Morten Wennevik" wrote:
Hi Joemanc,

Are you processing text in a textbox using the KeyPress event? If so, not
that the delete key does not appear in this event, but you can trap it in
KeyUp/KeyDown.

On Mon, 21 Aug 2006 20:43:01 +0200, Joemanc <jm****@cl-law.com.donotspam>
wrote:
I've converted my VB6 app to VB.NET 2003. For some strange reason, the
delete
key will not work in any of my textboxes in the application. The
backspace
key works just fine. The delete key works in textboxes in VB6. Is there
some
new event that I need to code for the delete key in VB.NET?

--
Happy Coding!
Morten Wennevik [C# MVP]
Aug 22 '06 #3
No, you don't have to detect the delete key for normal use of the textbox,
characters should be deleted using [Delete] or [Backspace], but unlike
[Backspace], which has a character \b, there is no character for [Delete].

Try trapping keys in a KeyDown event to see if the delet button is event
sent to the TextBox. It may be trapped by the form somehow.
On Tue, 22 Aug 2006 14:51:03 +0200, Joemanc <jm****@cl-law.com.donotspam>
wrote:
Morten - I am not not using the KeyPress event. Am I now required to
trap the
Delete keypress in .NET? Seems odd that I would have to trap the Delete
keypress keypress, but not the backspace key.

Oddly enough, I discovered in one of my application's smaller forms, the
delete button works. I double-checked the properties of the different
textboxes and the different forms and could not find any differences.

"Morten Wennevik" wrote:
>Hi Joemanc,

Are you processing text in a textbox using the KeyPress event? If so,
not
that the delete key does not appear in this event, but you can trap it
in
KeyUp/KeyDown.

On Mon, 21 Aug 2006 20:43:01 +0200, Joemanc
<jm****@cl-law.com.donotspam>
wrote:
I've converted my VB6 app to VB.NET 2003. For some strange reason, the
delete
key will not work in any of my textboxes in the application. The
backspace
key works just fine. The delete key works in textboxes in VB6. Is
there
some
new event that I need to code for the delete key in VB.NET?

--
Happy Coding!
Morten Wennevik [C# MVP]


--
Happy Coding!
Morten Wennevik [C# MVP]
Aug 23 '06 #4
Morton - I tried trapping keys using Keydown, and Delete was not detected. I
tried several other keys and they all worked.

Any thoughts on where I might be trapping the DELETE key? I haven't seen or
found anything obvious yet.

Seems like there are several new tools with .NET I can use to debug. I'm
fairly new to .NET, but I'll start taking a look at them.
"Morten Wennevik" wrote:
No, you don't have to detect the delete key for normal use of the textbox,
characters should be deleted using [Delete] or [Backspace], but unlike
[Backspace], which has a character \b, there is no character for [Delete].

Try trapping keys in a KeyDown event to see if the delet button is event
sent to the TextBox. It may be trapped by the form somehow.
On Tue, 22 Aug 2006 14:51:03 +0200, Joemanc <jm****@cl-law.com.donotspam>
wrote:
Morten - I am not not using the KeyPress event. Am I now required to
trap the
Delete keypress in .NET? Seems odd that I would have to trap the Delete
keypress keypress, but not the backspace key.

Oddly enough, I discovered in one of my application's smaller forms, the
delete button works. I double-checked the properties of the different
textboxes and the different forms and could not find any differences.

"Morten Wennevik" wrote:
Hi Joemanc,

Are you processing text in a textbox using the KeyPress event? If so,
not
that the delete key does not appear in this event, but you can trap it
in
KeyUp/KeyDown.

On Mon, 21 Aug 2006 20:43:01 +0200, Joemanc
<jm****@cl-law.com.donotspam>
wrote:

I've converted my VB6 app to VB.NET 2003. For some strange reason, the
delete
key will not work in any of my textboxes in the application. The
backspace
key works just fine. The delete key works in textboxes in VB6. Is
there
some
new event that I need to code for the delete key in VB.NET?

--
Happy Coding!
Morten Wennevik [C# MVP]

--
Happy Coding!
Morten Wennevik [C# MVP]
Aug 23 '06 #5
The only way I can think of is by using KeyPreview = true for your parent
form, and using the formm's KeyDown event, trapping the Delete Key, like
this

protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
e.Handled = true;
}

Another way is by overriding PreProcessMessage or WndProc, but I guess you
would know if you had used those.

If this problem exists solely in this single project I'm afraid I can't
help you without seeing your code.

On Wed, 23 Aug 2006 17:43:02 +0200, Joemanc <jm****@cl-law.com.donotspam
wrote:
Morton - I tried trapping keys using Keydown, and Delete was not
detected. I
tried several other keys and they all worked.

Any thoughts on where I might be trapping the DELETE key? I haven't seen
or
found anything obvious yet.

Seems like there are several new tools with .NET I can use to debug. I'm
fairly new to .NET, but I'll start taking a look at them.
"Morten Wennevik" wrote:
>No, you don't have to detect the delete key for normal use of the
textbox,
characters should be deleted using [Delete] or [Backspace], but unlike
[Backspace], which has a character \b, there is no character for
[Delete].

Try trapping keys in a KeyDown event to see if the delet button is event
sent to the TextBox. It may be trapped by the form somehow.
On Tue, 22 Aug 2006 14:51:03 +0200, Joemanc
<jm****@cl-law.com.donotspam>
wrote:
Morten - I am not not using the KeyPress event. Am I now required to
trap the
Delete keypress in .NET? Seems odd that I would have to trap the
Delete
keypress keypress, but not the backspace key.

Oddly enough, I discovered in one of my application's smaller forms,
the
delete button works. I double-checked the properties of the different
textboxes and the different forms and could not find any differences.

"Morten Wennevik" wrote:

Hi Joemanc,

Are you processing text in a textbox using the KeyPress event? If
so,
>not
that the delete key does not appear in this event, but you can trap
it
>in
KeyUp/KeyDown.

On Mon, 21 Aug 2006 20:43:01 +0200, Joemanc
<jm****@cl-law.com.donotspam>
wrote:

I've converted my VB6 app to VB.NET 2003. For some strange reason,
the
delete
key will not work in any of my textboxes in the application. The
backspace
key works just fine. The delete key works in textboxes in VB6. Is
there
some
new event that I need to code for the delete key in VB.NET?

--
Happy Coding!
Morten Wennevik [C# MVP]

--
Happy Coding!
Morten Wennevik [C# MVP]


--
Happy Coding!
Morten Wennevik [C# MVP]
Aug 24 '06 #6
Morten,
I added PreProcessMessage code to override, and that seemed to do the trick.
Not sure why the Delete keypress was getting eaten up. Thanks for your help!

"Morten Wennevik" wrote:
The only way I can think of is by using KeyPreview = true for your parent
form, and using the formm's KeyDown event, trapping the Delete Key, like
this

protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
e.Handled = true;
}

Another way is by overriding PreProcessMessage or WndProc, but I guess you
would know if you had used those.

If this problem exists solely in this single project I'm afraid I can't
help you without seeing your code.

On Wed, 23 Aug 2006 17:43:02 +0200, Joemanc <jm****@cl-law.com.donotspam>
wrote:
Morton - I tried trapping keys using Keydown, and Delete was not
detected. I
tried several other keys and they all worked.

Any thoughts on where I might be trapping the DELETE key? I haven't seen
or
found anything obvious yet.

Seems like there are several new tools with .NET I can use to debug. I'm
fairly new to .NET, but I'll start taking a look at them.
"Morten Wennevik" wrote:
No, you don't have to detect the delete key for normal use of the
textbox,
characters should be deleted using [Delete] or [Backspace], but unlike
[Backspace], which has a character \b, there is no character for
[Delete].

Try trapping keys in a KeyDown event to see if the delet button is event
sent to the TextBox. It may be trapped by the form somehow.
On Tue, 22 Aug 2006 14:51:03 +0200, Joemanc
<jm****@cl-law.com.donotspam>
wrote:

Morten - I am not not using the KeyPress event. Am I now required to
trap the
Delete keypress in .NET? Seems odd that I would have to trap the
Delete
keypress keypress, but not the backspace key.

Oddly enough, I discovered in one of my application's smaller forms,
the
delete button works. I double-checked the properties of the different
textboxes and the different forms and could not find any differences.

"Morten Wennevik" wrote:

Hi Joemanc,

Are you processing text in a textbox using the KeyPress event? If
so,
not
that the delete key does not appear in this event, but you can trap
it
in
KeyUp/KeyDown.

On Mon, 21 Aug 2006 20:43:01 +0200, Joemanc
<jm****@cl-law.com.donotspam>
wrote:

I've converted my VB6 app to VB.NET 2003. For some strange reason,
the
delete
key will not work in any of my textboxes in the application. The
backspace
key works just fine. The delete key works in textboxes in VB6. Is
there
some
new event that I need to code for the delete key in VB.NET?

--
Happy Coding!
Morten Wennevik [C# MVP]


--
Happy Coding!
Morten Wennevik [C# MVP]

--
Happy Coding!
Morten Wennevik [C# MVP]
Aug 29 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sam | last post by:
For Example, If I delete two times like the below code, the program will behave differently. is this correct? As C++ FAQ the delete checks where or not f1 has memory. How can the following program...
1
by: Douglas Peterson | last post by:
class Allocator { public: virtual void * Alloc(size_t) = 0; virtual void * Free(void*) = 0; }; class Object { public:
13
by: Axel Panning | last post by:
Hallo, ich hab bei einem Programm bei mir festgestellt, daß das "deleten" von Feldern erheblich länger dauert, als das Anlegen von Feldern. p. Bei einem Programm von mir werden oft große...
30
by: jimjim | last post by:
Hello, This is a simple question for you all, I guess . int main(){ double *g= new double; *g = 9; delete g; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl; *g =...
7
by: morz | last post by:
i just search for a while in c++ groups but cannot find good answer. i have code like this: int **ptr; ptr = new char *; ptr = new int(5); ptr = new int(16);
16
by: Martin Vorbrodt | last post by:
some butthole asked me an interview question: can you delete "this" pointer in a member function of a class, like this: class C { public: void foo() { delete this; } }; my answer was......
15
by: LuB | last post by:
I am constantly creating and destroying a singular object used within a class I wrote. To save a bit of time, I am considering using 'placement new'. I guess we could also debate this decision -...
29
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I remembered delete is implemented through operator overloading, but I am not quite clear. Could anyone recommend some links about how delete is implemented so that I can...
12
by: subramanian100in | last post by:
Suppose class Base { public: virtual ~Test() { ... } // ... }; class Derived : public Base
19
by: Daniel Pitts | last post by:
I have std::vector<Base *bases; I'd like to do something like: std::for_each(bases.begin(), bases.end(), operator delete); Is it possible without writing an adapter? Is there a better way? Is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.