The following plugin specifies the data file for group number 1. First, it checks to make sure that there are no open modal dialogs that could prevent Amos Graphics from responding correctly.
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
Exit Function
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")
Else
MsgBox("Unsuccessful")
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