Click to See Complete Forum and Search --> : Undo on an MSFlexGrid
rockies1
October 22nd, 2001, 02:12 PM
I have an app that allows users to select items from a ComboBox, click a FlexGrid and the item in the ComboBox apperars in the FlexGrid.
Works great.
Users have asked for an Undo feature.
I've thrown up my hands and yelled "I don't know how to do that!" but they insist.
Anyone have any pointers on how to implement Undo on the FlexGrid?
Thanks!
Iouri
October 22nd, 2001, 03:19 PM
'Windows API provides an undo function
'Do the following declares:
Declare Function SendMessage Lib "User" (ByVal hWnd As _
Integer, ByVal wMsg As Integer, ByVal wParam As _
Integer, lParam As Any) As Long
Global Const WM_USER = &h400
Global Const EM_UNDO = WM_USER + 23
'And in your Undo Sub do the following:
UndoResult = SendMessage(myControl.hWnd, EM_UNDO, 0, 0)
'UndoResult = -1 indicates an error.
=========================================================
'another approach can be done if you memorize the cell where you enter tha last entry and on 'Undo' button set the cell value to ""
Iouri Boutchkine
iouri@hotsheet.com
wajahath
October 25th, 2001, 12:53 PM
Try this out ,
When you click the msflex to enter the new selection from the combo,Before updating the new value to the cell, trap the value of the cell using
msflex.textmatrix(msflex.row,msflex.col) in a variable say Temp.
temp=msflex.textmatrix(msflex.row,msflex.col)
Then on the undo button click assign the
msflex.textmatrix(msflex.row,msflex.col)=temp
Let me if this works.
wajahath
October 25th, 2001, 01:14 PM
Dim temp as string
private Sub Command1_Click()
MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col) = temp
End Sub
private Sub Form_Load()
MSFlexGrid1.TextMatrix(1, 1) = "apple"
End Sub
private Sub MSFlexGrid1_Click()
temp = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col)
MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col) = Combo1.Text
End Sub
Here is an example using a combo1 msflexigrid1 and command1 controls
create the three controls and paste the code and add a few items to the list property of the combo1.
PLEASE let me know if you hav any questions
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.