logo
vbRad Home
Source Code
Book Reviews
Forum
Links
About Us
Contribute

Compare Databases with SQL Effects Clarity
 
 How to undo a textbox

Posted on
2/18/2001
Author:
Robert Gelb
Email:
Not Shown
Applies To OS:
NT, 9x, 2000
Product:
4, 5, 6



Code below provides the following functionality:

  • Undo a textbox
  • Determine whether a textbox can be undone
  • Empty undo buffer, thereby disabling the undo functionality

Project Instructions
  1. Create a new standard project
  2. Add 1 textbox and 3 command buttons.
  3. Set the Caption of the first command button to Undo
  4. Set the Caption of the second command button to Empty Undo Buffer
  5. Set the Caption of the third command button to Can be undone?
Add the following to a Form
Private Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any) As Long
Private Const EM_CANUNDO = &HC6
Private Const EM_EMPTYUNDOBUFFER = &HCD
Private Const EM_UNDO = &HC7

Private Sub Command1_Click()
    SendMessage Text1.hwnd, EM_UNDO, 0&, 0&
End Sub

Private Sub Command2_Click()
    SendMessage Text1.hwnd, EM_EMPTYUNDOBUFFER, 0&, 0&
End Sub

Private Sub Command3_Click()
    Dim retcode As Long
    
    retcode = SendMessage(Text1.hwnd, EM_CANUNDO, 0&, 0&)
    If retcode Then
        MsgBox "The text box can be UNDOne"
    Else
        MsgBox "The text box cannot be UNDOne"
    End If
End Sub
Remarks

Run the project, type something into the text box and test out various functions.



Add Your Comment  

Name: Email Address: all fields optional
Notify me via email when someone responds to this message (valid email required).

Enter the word:
 



Comments
#1. By jignesh. Posted on 4/27/2006 7:33:16 AM
i have a problem i vb 6.
i have an one application named report with database sql server

plz give me code for from date to todate

1st textbox name= txtfrom.text
2nd textbox name=txtto.text

there was a one grid named mshflexgrid,

so i want to fill gird with from date to todate plz give me code



thanking you

jignesh

#2. By mousa basiratnia. Posted on 5/9/2007 4:34:07 PM
hi
im an irania man that i wrote a programme like nero but a area of this programme faced problem . my problem is this that i cant write a function in vb.
this function is very very hard for me.
i wanna a function that write information in cd
and erase cd after writing
just this 2 function
for this reqest i will spend every mony that u want of me
iranian cant write this function
and i refer to you.
thanks alot
my name is mousa basiratnia
my id : 3112284