Examples: BeforeModalDialog event

In this example, the BeforeModalDialog event procedure programmatically answers a dialog for the user. The dialog opens when the user enters a nonexistent shipping method. Before the accounting system can display this dialog, the procedure automatically “clicks” the Add button, allowing the user to add the new shipping method:

Private Sub Window_BeforeModalDialog(ByVal DlgType As Long, _ PromptString As String, Control1String As String, Control2String _ 
As String, Control3String As String, Answer As Long)
	If PromptString = "Do you want add this Shipping Method?" Then
		'Click the first button, the Add button
		Answer = dcButton1
	End If
End Sub

Documentation Feedback