Hello all,
I am new to .NET and a i am moving from Delphi (finally!) to C#.
Now, i am trying to develop custom TextBox for numeric input. I have done it
almost, now i need to prevent paste so someone couldnt paste letters into
numeric text box. How this can be done in C#? In Delphi there was method to
implement methods wiht message code WM_PASTE, and within that method i could
control the contents of the pasted text.
Thanks.
Radovan 3 15299
To intercept messages in textbox control, derive a class from TexBox and
implement
protected override void WndProc(ref Message m)
{
case 0x302: //WM_PASTE
{
}
base.WndProc(re f m)
}
--
Shak
(Houston)
"Radovan Radic" <ra****@eunet.y u> wrote in message
news:ui******** ******@TK2MSFTN GP09.phx.gbl... Hello all,
I am new to .NET and a i am moving from Delphi (finally!) to C#. Now, i am trying to develop custom TextBox for numeric input. I have done
it almost, now i need to prevent paste so someone couldnt paste letters into numeric text box. How this can be done in C#? In Delphi there was method
to implement methods wiht message code WM_PASTE, and within that method i
could control the contents of the pasted text.
Thanks. Radovan
To intercept messages in textbox control, derive a class from TexBox and
implement
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case 0x302: //WM_PASTE
{
}
default:
base.WndProc(re f m)
}
}
--
Shak
(Houston)
"Radovan Radic" <ra****@eunet.y u> wrote in message
news:ui******** ******@TK2MSFTN GP09.phx.gbl... Hello all,
I am new to .NET and a i am moving from Delphi (finally!) to C#. Now, i am trying to develop custom TextBox for numeric input. I have done
it almost, now i need to prevent paste so someone couldnt paste letters into numeric text box. How this can be done in C#? In Delphi there was method
to implement methods wiht message code WM_PASTE, and within that method i
could control the contents of the pasted text.
Thanks. Radovan
Thanx a lot Shakir, i appreciate your help.
Radovan
"Shakir Hussain" <sh**@fakedomai n.com> wrote in message
news:uC******** ******@TK2MSFTN GP11.phx.gbl... To intercept messages in textbox control, derive a class from TexBox and implement
protected override void WndProc(ref Message m) { switch(m.Msg) { case 0x302: //WM_PASTE { } default: base.WndProc(re f m) } }
-- Shak (Houston)
"Radovan Radic" <ra****@eunet.y u> wrote in message news:ui******** ******@TK2MSFTN GP09.phx.gbl... Hello all,
I am new to .NET and a i am moving from Delphi (finally!) to C#. Now, i am trying to develop custom TextBox for numeric input. I have
done it almost, now i need to prevent paste so someone couldnt paste letters
into numeric text box. How this can be done in C#? In Delphi there was method to implement methods wiht message code WM_PASTE, and within that method i could control the contents of the pasted text.
Thanks. Radovan
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: VitoriaTang |
last post by:
I want to know how to capture the paste message.
I tried to capture the WM_PASTE, but it seems as the
richtextbox doedn't send this message.
But in fact, I can find the textbox will send paste
message when I press CTRL+V.
(Don't tell me to capture the key press event)
|
by: Dan K. |
last post by:
Hi Folks,
Problem is, that on one of my controls the DEL key wont work in
textboxes. i have different controls of this kind in my app and this
is the only one the DEL Key wont do his job. BACKSPACE and rightclick
menu delete works either. seems the DEL Key fires no event ... i
insert following code in my project to check this. no mehthod call if
DEL key hit ... any solution or idea for this problem ?
cant say ... users on this...
|
by: Legendary Pansy |
last post by:
I was checking out the 101 C# Samples, specifically Windows Forms - Use the Clipboard. I took a look at the code for a while, and I understand what the program is doing with the cut, copy, pasting via the file menu events using the clipboard. However, what I don't get is how is the program able to produce a context menu in the textbox area. When right clicking, the context pops up and allows to cut/copy/paste/delete, etc..
But the thing is, I...
|
by: John |
last post by:
Hi
How can I implement cut or copy or paste in code?
Thanks
Regards
|
by: Stefan De Schepper |
last post by:
Dear NG,
I created a gridlike usercontrol. When clicking on a cell a textbox (or
other control, depending on the cell's editortype) is shown. When some other
control gets the focus, the textbox is hidden. So far, no problem.
But when the textbox is visible and, for instance, I click on a
toolbarbutton, the textbox' Lostfocus event is not fired. The situation
should be that wherever I click, apart from the cell or textbox itself, the...
| |
by: Steve |
last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user
clicks on a toolbar button, the cut/copy/paste will work with whatever
textbox the cursor is current located in (I have about 20 textboxes on the
form). Also to ensure that the button can't get used if the cursor isn't in
a textbox field. And to ensure the contents of the clipboard are "text"
contents that have been cut/copied from one of the textboxes on the form.
...
|
by: Simon Verona |
last post by:
Sorry for the repost, but this group seems to be more "active" than the
group that I posted my question, and it's probably as valid here as there!
I have a usercontrol, which contains a textbox (as well as other controls).
The textbox is set for multiline, so it *should* accept an Enter Key to move
down to the next line.
However, I'm finding that if I put the control onto a form which has a
default Accept button set, then pressing...
|
by: John |
last post by:
Hi
In a winform app I need to provide a menu with Cut, Copy and Paste options.,
What code do I use to accomplish cut, copy and paste features for fields on
a winfrom?
Thanks
Regards
|
by: jh |
last post by:
I'd like to copy/paste into a listbox during runtime. I can do this for a
textbox but can't figure out how to accomplish this for a listbox. Any
help? Thanks.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |