Winforms

Showing a modal form

Using insertForm As New frmProductPrijs
  If insertForm.ShowDialog(newPrice) = Windows.Forms.DialogResult.OK Then
    ...
  Else
    ...
  End If
End Using
Friend Class frmProductPrijs
  Inherits Windows.Forms.Form

  Public Property Price As Price

  Public Overloads Function ShowDialog(ByVal priceToUpdate As Price) As System.Windows.Forms.DialogResult
    Price = priceToUpdate
    Return MyBase.ShowDialog()
  End Function

  Private Sub cmdOK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOK.Click
    Me.DialogResult = Windows.Forms.DialogResult.OK
    Me.Close()
  End Sub

  Private Sub cmdAnnuleren_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdAnnuleren.Click
    Me.DialogResult = Windows.Forms.DialogResult.Cancel
    Me.Close()
  End Sub

End Class
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License