Monday 6 June 2016

Opening, Closing, and Hiding Forms with Visual Basic .NET

Opening,Showing, Closing, and Hiding Forms with Visual Basic .NET


NOTE-Before you can open (or close) a form, you need to know the specific name of the form you want to open or close. The Solution Explorer window lists the names of all the forms that make up your Visual Basic .NET program, such as a form named frmMain.vb.

Opening a form:

After you know the name of the form that you want to display, you need to use BASIC command to open the form, such as the following:
Dim oForm As FormName
oForm = New FormName()
oForm.Show()
oForm = Nothing

Hiding a form

If you want to temporarily make a form disappear, you can use the magic Hide command, such as:
FormName.Hide()

Showing a form

After you've hidden a form, you'll eventually want to make it visible again by using the Show command, such as:
FormName.Show()

Closing a form

Hiding a form just tucks it out of sight, but the form is still loaded in the computer's memory. To clear a form out of memory, you need to use the Close command, such as:
FormName.Close()


No comments:

Post a Comment