C# Close Form and Open New Form

C# Close Form and Open New Form

26/04/2020 0 By Admin

This code snippet references a method to close the existing winform and open a new winform. It is part of a larger windows program.

Application

This allows for a new form to be opened when a user has completed entering data into the existing form and needs to move to the next page.

Explanation

Line 137 The this keyword refers to the current object while the .Hide() method hides it.

Line 138 A class Form4Service is created, and f4 is the new instance/object created of this class.

Line 139 The .Show() method is used to call the new object.