Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.52 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How does one overide the OnShown Event of a form when creating a form programatically
  2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.     Dim f As Form1 = New Form1()
  4.     AddHandler f.Shown, AddressOf f_Shown
  5.     f.Show()
  6. End Sub
  7.  
  8. Private Sub f_Shown(ByVal sender As Object, ByVal e As EventArgs)
  9.  
  10. End Sub
  11.        
  12. Public Sub form_Showing(ByVal sender As Object, e As EventArgs)
  13.   // play sound
  14. End Sub
  15.        
  16. Dim f As New Form
  17. AddHandler f.Shown, AddressOf form_Showing
  18. f.Show()