Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Form Unload in vb.net

Hi Experts,

I have tab control with 4 tabs. When I click the tab it loads a form. How can I unload the form when I go to the next tab.

Thank you.
0
RadhaKrishnaKiJaya
Asked:
RadhaKrishnaKiJaya
1 Solution
 
it_saigeDeveloperCommented:
You could always use <yourformvariable>.Close(), e.g. -
' Make a variable that holds a reference to Tab Form instances.
Private tabForm As Form;
' Somewhere in your code, lets say a button click for TabOne
Private Sub OnTabOneButtonClick(ByVal sender As Object, ByVal e As EventArgs) Handles TabOneButton.Click
     tabForm = New TabOneForm()
     tabForm.Show()
End Sub

Private Sub OnTabSelected(ByVal sender As Object, ByVal e As TabControlEventArgs) Handles MainTabControl.Selected
     If Not tabForm Is Nothing
          tabForm.Close()
     End If
End Sub

Open in new window


This is completely untested and just off the top of my head.

-saige-
0
 
RadhaKrishnaKiJayaAuthor Commented:
Thank u very much for your help.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now