评估模态对话框的结果

评估模态对话框的结果

本文介绍了评估模态对话框的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

    With Me.PrintForm1

      .PrinterSettings.PrinterName = "doPDF v7"

      Dim MyMargins As New Margins

      With MyMargins
        .Left = 50
        .Right = 0
        .Top = 40
        .Bottom = 0
      End With

      .PrinterSettings.DefaultPageSettings.Margins = MyMargins

      Try
        .Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)

        If DialogResult.OK Then GoTo TellIt
        If DialogResult.Cancel Then GoTo BreakOut

      Catch ex As Exception

        MessageBox.Show("doPDF v7 NOT Installed," & vbCrLf & "Cannot create pdf file!", "Error", _
                MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1)
      End Try

TellIt:

      MsgBox("File Created")


    End With

BreakOut:

  End Sub

推荐答案

有点像diz:


    Dim prntDialog As New PrintDialog()

    If prntDialog.ShowDialog(Me) = DialogResult.OK Then

    End If

    'or

    Dim TheResult As DialogResult = prntDialog.ShowDialog

    If TheResult = DialogResult.OK Then

    End If


这篇关于评估模态对话框的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:16