The following plugin checks to make sure that there are no open modal dialogs that may prevent Amos Graphics from responding correctly. Then the plugin specifies the data file for group number 1.
Imports System
Imports Microsoft.VisualBasic
Imports Amos
Imports PXMLPersist.CDataTable
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
Implements IPlugin
Public Function Mainsub() As Integer Implements IPlugin.Mainsub
Dim S As String
'Wait until Amos Graphics can respond
Do
S = pd.CanRespond(True)
If S = "" Then
Exit Do
End If
If MsgBox(S, vbOKCancel) = vbCancel Then
Return 0
End If
Loop
' Change the data file for group number 1
If pd.SetDataFile(1, cDatabaseFormat.mmEXCEL97, _
pd.AmosDir & "Examples\English\userguide.xls", _
"grant", "", 0) = 0 Then
MsgBox("Successful",, "CanRespond Example")
Else
MsgBox("Unsuccessful",, "CanRespond Example")
End If
End Function
Public Function Name() As String Implements IPlugin.Name
End Function
Public Function Description() As String Implements IPlugin.Description
End Function
End Class