Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

Problem with undo delete in TextBox control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Predrag Rakic - 12 Jan 2005 11:53 GMT
How can be selected text in a TextBox deleted by issuing some TextBox class method or property? The goal of the deletion is that it can be undone. I have tryed to delete text with textBox.SelectedText = "", which functions as it can be expected, but can not be undoned.What is interesting, is that it functions well with RichTextBox control. Regards, Predrag.
Claes Bergefall - 13 Jan 2005 10:33 GMT
.NET doesn't have a built in way of doing that.
You'll have to use PInvoke:

[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SendMessage(System.IntPtr hWnd, int msg, int
lParam, int wParam);
private const int WM_CLEAR = 0x0303;
...
SendMessage(myTextBox.Handle, WM_CLEAR, 0, 0);

  /claes

> How can be selected text in a TextBox deleted by issuing some TextBox class method or property? The goal of the deletion is that it can be undone.
I have tryed to delete text with textBox.SelectedText = "", which functions
as it can be expected, but can not be undoned.What is interesting, is that
it functions well with RichTextBox control. Regards, Predrag.

> ---
> Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Predrag Rakic - 14 Jan 2005 12:37 GMT
Hi Claes, undo delete in TextBox control works fine. Thanks, Predrag.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.