Undo Changes in Text Boxes

Undo Changes in Text Boxes

Most professional applications have an Undo menu option under the Editmenu. If you want to have an undo feature for every text box, you may thinkyou need to create a variable to hold the old value for every field. Fortunately,Windows takes care of this for you. With a call to the Windows API functionSendMessage(), you can have the old value put back into the text box. Createa menu item called Undo and add this code:

 Sub mnuUndo_Click () Call TextUndo(Screen.ActiveControl) End Sub TextUndo() is responsible for performing the undo: Declare Function SendMessage Lib "User" _ (ByVal hWnd As Integer, ByVal wMsg As Integer, _ ByVal wParam As Integer, lParam As Any) As Long Sub TextUndo (ctlControl As Control) Dim lReturn As Long Const EM_UNDO = &H417 If TypeOf Screen.ActiveControl Is TextBox Then lReturn = SendMessage(ctlControl.hWnd, _ EM_UNDO, 0, 0&) End If End Sub

Because some third-party controls also support the undo message,place TextUndo() in a separate routine to make it easy to change this onefunction by adding the Class name of the third-party control. If you do,there will be no reason to change all the calls to the SendMessage() function.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes