The goal of C#Builder is to make you more productive while implementing code. In doing so, C#Builder has features for automating common tasks that all developers perform. For example, all projects have to start with a base set of code and references. To accomplish this without an IDE, a developer would create one or more files, add skeleton code (often cutting and pasting from an existing file), and ensure that the environment is set up properly so that libraries and other files may be referenced. With C#Builder, many of these tasks are already automated with tools that I'll refer to as wizards. C#Builder has project wizards that perform all tasks necessary for creating new projects. These wizards create a new Project Group, add files containing predefined code that pertains to the project type, and add default references to resources the project needs to run. Because each wizard is specific to each type of project, a full discussion of the details is premature at this point in the book. Later chapters go into detail on each type of project that can be created, such as Console, Windows Forms, ASP.NET, and so on. However, to prepare you for what's to come, this section provides an overview of the basics associated with C#Builder project wizards.
I normally begin creating a new project from the Welcome Page (see Figure 1.2) because it is convenient and available as soon as C#Builder starts up. As described in the preceding section, the Welcome Page contains links for working with projects. Above the Recent Projects section is a set of links: New, Open Project, Open File, and Help. Moving the cursor over each link makes it change color from black to red. To create a new project, click the New link, which will make the New Items dialog appear, as in Figure 1.3. Another way to open the New Items dialog is to choose File, New, Other. Figure 1.3. The New Items dialog.Select the C# Projects folder in the Item Categories list to view available wizards. Select the Console Application icon and click the OK button. (For this chapter and through Chapter 4, all projects will be Console Applications.) This brings up the New Application dialog, shown in Figure 1.4, where you specify the name and location of the project. By default, the location will always be set in the Borland Studio Projects folder under your personal My Documents folder. You can either traverse the directory structure to get to where the project should be located or enter a location in the Location field. The Location field is handy when you have Windows Explorer open to the destination directory. That way, it is easy to copy and paste the path from the Windows Explorer address bar straight into the Location field. Click the OK button to create the project. Figure 1.4. The New Application dialog.As with all other wizards, a Project Group, Project, and default files are created automatically. Because the purpose of this chapter is to get you up and running quickly, I'll delay in-depth discussion of project management until Chapter 5. The file that is created for a Console Application is a C# source code file named Class.cs. The convention for C# source code file extensions is .cs. Class.cs contains skeleton source code that compiles, but doesn't really do anything. For this example, I changed the filename from Class.cs to Welcome.cs. Each item in the Project manager has in-place editing: You click the file one time, wait a second (avoiding a double-click), and then click the filename again. This puts the file into editing mode, where its name can be changed. Be careful not to change the file extension, which could make C#Builder not recognize it properly. To run this program, choose Run, Run Without Debugging. The program will compile, the desktop will reconfigure, and the program will flash on the screen and go away as it runs and completes very quickly. The next section shows how to write a very simple program that prints a greeting to the console screen. |