Advertisement
Guest User

Untitled

a guest
May 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. ' This is a form with 2 buttons, one to create the form and one to close the other form.
  2. Public Class Form2
  3.  
  4. Public Class myForms
  5. Public Shared forms(4) As System.Windows.Forms.Form
  6. End Class
  7.  
  8. Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9. myForms.forms(0) = Me
  10. End Sub
  11.  
  12.  
  13. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  14. Dim myform1 As New Form4
  15. myform1.Show()
  16. myForms.forms(1) = myform1
  17.  
  18. Dim myform2 As New Form4
  19. myform2.Show()
  20. myForms.forms(2) = myform2
  21.  
  22. End Sub
  23.  
  24. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  25. myForms.forms(1).Close()
  26. myForms.forms(2).Close()
  27.  
  28. myForms.forms(1) = Nothing
  29. myForms.forms(2) = Nothing
  30. End Sub
  31. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement