Visual C# | Data structures exercise | Build up a list of films to display in a datagridview

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the course listed below!

Software ==> Visual C#  (79 exercises)
Version ==> Any version of C#
Topic ==> Data structures  (6 exercises)
Level ==> Average difficulty
Course ==> Intermediate C#
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Right-click on your project, and choose to add the Film.cs class into it.  Have a look at this class to see what it contains:

Film class

This class allows you to store the details of a film.

 

Create a new form called frmFilms, and add a button and a datagridview to create this:

Empty form

Call your controls btnShow and dgvFilms.

Add code to the button so that when you click on it you see a list of your favourite films:

Favourite films

Your list will be (very) different!

Your code should:

  1. Create a new list of objects of type Film;
  2. Create a few objects of type Film, adding each to this list;
  3. Set the DataSource property of the datagridview to be this list.

When you've finished, close down any open windows.

This page has 0 threads Add post