Naming Objects

The property you should always set first for any new object is the Name property. Press F4 to display the Properties window (if it's not already visible), and scroll down to the Design section to see the “(Name)” property. The default name is Form1. When you first create an object, Visual C# .NET gives the object a unique, generic name based on the object's type. Although these names are functional, they simply aren't descriptive enough for practical use. For instance, Visual C# .NET named your form Form1, but it's common to have dozens of forms in a project, and it would be extremely difficult to manage such a project if all forms were distinguishable only by a number (Form2, Form3, and so forth).

In actuality, what you're working ...

Get Sams Teach Yourself Microsoft® Visual C#™ .NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.