Let’s Run!

At this point, we have dropped a data source onto the form, and Visual Studio has done its code generation thing. We should be able to run the application and, even though we haven’t entered any data, we should at least get an empty form. So press F5 or click on the Start button. Hey, it works! We see the form on the screen.

But wait… something’s wrong. This isn’t the form we’ve been working on. The data grid view should have column titles, plus we changed the Text property of the form to read “Client List.” This form is the first one we created, not the one we created by copying the first one.
What we need to do is change the startup form. For this, in Solution Explorer, view the code for the file Program.cs. It will look like this.

namespace TheBooks
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

All we need to do is change the line Application.Run(new Form1()); to indicate the correct form to run, which is Client List. When we do that and run the application, we finally get the correct form.

There’s a lot left to do. We’re going to have to adjust the columns of the data grid view, and we’re going to have to have some data to display even before we have the form that inserts new data. For this, fire up SQLite Studio and manually enter some client records. Three or four should be fine.

Leave a Reply

Your email address will not be published. Required fields are marked *