Private Sub DisplayMessage(ByVal owner As IWin32Window, ByVal message As String, ByVal caption As String, ByVal buttons As MessageBoxButtons, ByVal icon As MessageBoxIcon, ByVal defaultButton As MessageBoxDefaultButton, _
ByVal helpFilePath As String, ByVal keyWord As String)
' Set the HelpNavigator so the Help button appears on the UltraMessageBox
Dim navigator As HelpNavigator = HelpNavigator.KeywordIndex
' If the owner is not set or the owner if the current form and it is a MDI Child,
' use the overload with the IWin32Window owner
If owner IsNot Nothing Then
Dim ownerForm As Form = TryCast(Form.FromHandle(owner.Handle), Form)
If ownerForm IsNot Nothing AndAlso ownerForm.IsMdiChild = True Then
UltraMessageBoxManager.Show(message, caption, buttons, icon, defaultButton, helpFilePath, _
navigator, keyWord)
Else
UltraMessageBoxManager.Show(owner, message, caption, buttons, icon, defaultButton, _
helpFilePath, navigator, keyWord)
End If
Exit Sub
End If
UltraMessageBoxManager.Show(message, caption, buttons, icon, defaultButton, helpFilePath, _
navigator, keyWord)
End Sub