1 Attachment(s)
How to customize MS DataGrid Control canceled message box?
How can i customize the MS DataGrid Control 6.0 canceled action message box?
Attachment 172763
For example can I add a custom message instead of just showing "Action is canceled"?
Note: This is a message box that appears when you set Cancel = True to a for example BeforeUpdate event on a DataGrid, like so:
Code:
Private Sub DataGrid1_BeforeUpdate(Cancel As Integer)
Cancel = validateMyData(CStr(DataGrid1.Columns(1).Value))
' If Cancel = -1(True), the message box is displayed saying cannot progress to
' different row if the data is not corrected
' if Cancel = 0(False), i can freely move other row.
End Sub
Re: How to customize MS DataGrid Control canceled message box?
Replacing a modal dialog displayed by an external control isn't that easy, but not too difficult either. I think the most common method when you know a dialog will be displayed is:
1. Create a CBT hook that looks for newly created dialog windows
2. Allow the event to do the cancel action
3. The CBT hook catches the dialog window and you prevent it from being created/displayed
4. Remove the CBT hook
5. Display your own message box
Note: if the datagrid supports multiple languages, you can lose the advantage of displaying the message in the user's language
CBT hook examples exist on this forum. Here is documentation regarding hooks in general
https://docs.microsoft.com/en-us/win...sg/about-hooks