Free Visual C# exercises

This page lists 79 Visual C# exercises. You can use the menu to show just exercises for a specific topic.

Software: Visual C#
Version: Any version of C#
Topic: Enumerations and constants
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Use an enumeration to test which age band a dating agency applicant falls into.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Creating classes
Level: Relatively easy
Course: Intermediate C#
Exercise: Write a class to make existing code to display a football score work.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Properties in C#
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Use read-only properties to process a dating agency application.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Inheritance
Level: Relatively easy
Course:
Exercise: Inherit the Form class to create a custom WinForms form template.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Using lists
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Write a C# program to create an integer list of the first few squares.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Modular code
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Write your own procedure to display a message box, with 2 arguments.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Data structures
Level: Relatively easy
Course: Intermediate C#
Exercise: Use a list to add, remove, count and display the Beatles.

Go to exercise ...

Software: Visual C#
Version:
Topic: Creating forms
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Create a simple form for entering a star sign, setting tab order, tooltips and accelerator keys.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Introduction to DataGridViews
Level: Relatively easy
Course:
Exercise: Create a DataGridView showing mortgage types from an Access database, and format it to look pretty.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Creating forms
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Create a simple form, with two text boxes, two buttons and a GroupBox, to show one star sign.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Validating forms
Level: Relatively easy
Course:
Exercise: Create a form for entering the age of a person using a NumericUpDown control.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: LINQ with Entity Frameworks
Level: Relatively easy
Course: Intermediate C#
Exercise: Use a simple LINQ statement to list out all of the events in a table.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Looping
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Find the longest text in a combo box by looping over its items.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Creating classes
Level: Relatively easy
Course: Intermediate C#
Exercise: Create a class to hold an item in a shopping list, and use this to create a shopping list.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Creating classes
Level: Relatively easy
Course: Intermediate C#
Exercise: Create a shopping list form by creating a new shopping item class.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Inheritance
Level: Relatively easy
Course:
Exercise: Take a reality TV show application, and use inheritance to make it more specific.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Writing LINQ
Level: Relatively easy
Course: Intermediate C#
Exercise: Enumerate string names of Dr Who candidates using LINQ.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Entity Frameworks
Level: Relatively easy
Course: Intermediate C#
Exercise: Listing authors and book counts using LINQ to SQL classes.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: C# variables
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Use variables and the Length property to show how long text is.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Debugging and trapping errors
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: First step through lines of code, then add DEBUG.WRITE and DEBUG.INDENT statements to create trace information.

Go to exercise ...

Software: Visual C#
Version:
Topic: Validating forms
Level: Relatively easy
Course:
Exercise: Using a NumericUpDown control to check that an age is filled in correctly.

Go to exercise ...

Software: Visual C#
Version:
Topic: Validating forms
Level: Relatively easy
Course:
Exercise: Create a form for entering a name and age, and add validation on the Validating event to check both are filled in correctly.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Conditions
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Use C# if conditions to check a user has filled in a form.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Laying out your code
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Create a C# program to display choices made in a message box.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Files and folders
Level: Relatively easy
Course: Introduction to Visual C#
Exercise: Use a StreamWriter to write data input to a text file.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Toolbars, menus and status bars
Level: Average difficulty
Course:
Exercise: Create a menu, toolbar and short-cut menu for a form, including full coding.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: LINQ with Entity Frameworks
Level: Average difficulty
Course: Intermediate C#
Exercise: Use LINQ to add rows to two different tables, saving your changes.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Arrays
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Store items typed into a textbox in an array, then loop over its items.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Data structures
Level: Average difficulty
Course: Intermediate C#
Exercise: Create a list of objects, add items to it and display the results.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Properties in C#
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Create read-only properties for weight, height and BMI.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: C# variables
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Create a private variable for a form to keep track of button clicks.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Creating forms
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Draw a form allowing a dating agency candidate to enter their name and date of birth, and choose their sexuality from a drop list.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Modular code
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Write a function to return a man's oomph factor given various inputs.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Modular code
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Write a C# function to return a person's BMI from their height/weight.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Data structures
Level: Average difficulty
Course: Intermediate C#
Exercise: Use a sorted dictionary to create a prioritised to-do list in C#.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Inheritance
Level: Average difficulty
Course:
Exercise: Create a recurring task class inheriting from a base to-do task.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Data structures
Level: Average difficulty
Course: Intermediate C#
Exercise: Create a class to hold to-do tasks, and a list to hold these tasks.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Inheritance
Level: Average difficulty
Course:
Exercise: Use a cuddly toy class to inherit from a base toy class.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Advanced LINQ
Level: Average difficulty
Course: Intermediate C#
Exercise: Use LINQ anonymous types to return star signs as new 2-property class.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Interfaces
Level: Average difficulty
Course:
Exercise: Add an interface so room hires and dates are treated the same way.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: The form as a class
Level: Average difficulty
Course: Intermediate C#
Exercise: Create a Countdown game program, using a class to generate letters.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Delegates and events
Level: Average difficulty
Course:
Exercise: Use a delegate in a class to move a form button right and down.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Laying out your code
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Use C# to customise a message box title and caption from form entries.

Go to exercise ...

Software: Visual C#
Version:
Topic: Creating forms
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Create a form to allow someone to enter their name, choose their date of birth using a DateTimePicker and their preferences using a ComboBox.

Go to exercise ...

Software: Visual C#
Version:
Topic: Validating forms
Level: Average difficulty
Course:
Exercise: Using ErrorProvider controls to check someone fills their age in correctly on a form.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Using lists
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Create a list of dates falling on the 13th, then reduce this to Fridays.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Grouping using LINQ
Level: Average difficulty
Course: Intermediate C#
Exercise: Use LINQ grouping to show directors by their year of birth.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Using lists
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Read a text file line by line into a string list, then print it back out.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Writing LINQ
Level: Average difficulty
Course: Intermediate C#
Exercise: Project a star sign class into an enumerable string list using LINQ.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: LINQ to SQL
Level: Average difficulty
Course:
Exercise: Use LINQ to SQL to show loss-making films, with their studios.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Files and folders
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Write code to loop over files, reading lines to find hidden text.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: C# variables
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: A user inputs their minimum required allowance - use variables to check this is a number, and within range.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: LINQ with Entity Frameworks
Level: Average difficulty
Course: Intermediate C#
Exercise: Use a LINQ statement to populate a grid of events (returning an anonymous type).

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Advanced LINQ
Level: Average difficulty
Course: Intermediate C#
Exercise: LINQ: list Mondays till Xmas using anonymous types and skipping items.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: DataGridView events
Level: Average difficulty
Course:
Exercise: Apply conditional formatting to rows of a a DataGridView by coding the CellFormatting event.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: DataGridView events
Level: Average difficulty
Course:
Exercise: Attach code to a DataGridView so that the CellValidating event prevents invalid entries (also includes setting the ErrorText property of a row).

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: FileDialogs and StreamReaders
Level: Average difficulty
Course:
Exercise: Use an OpenFileDialog to find files to search, then read them in with a StreamReader to find hidden text.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Validating forms
Level: Average difficulty
Course:
Exercise: Check the age of a person, and display an ErrorProvider control if it is not valid.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Data structures
Level: Average difficulty
Course: Intermediate C#
Exercise: Create a shopping list, using a structure and a generic list.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Enumerations and constants
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Use project resources to hold and display an image and a string constant giving your name and photo.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Validating forms
Level: Average difficulty
Course:
Exercise: Attach code to the Validating event of a form to check textboxes are correctly filled in.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Looping
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Loop over a form's controls, checking the text boxes are filled in.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Conditions
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Add lots of validation code to a form to check all controls filled in.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: C# variables
Level: Average difficulty
Course: Introduction to Visual C#
Exercise: Display the sum of numbers entered in a calculator using variables.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: DataGridView events
Level: Average difficulty
Course:
Exercise: Ask a user if they really want to delete a row in a DataGridView, allowing event to cancel deletion if required.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Delegates and events
Level: Harder than average
Course:
Exercise: Use an event and delegate to get a button which monitors its pinkness.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: LINQ with Entity Frameworks
Level: Harder than average
Course: Intermediate C#
Exercise: Populate two combo boxes in a form, and use criteria to list out events.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Properties in C#
Level: Harder than average
Course: Introduction to Visual C#
Exercise: Play snog, marry or avoid in C#, making heavy use of lists.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Interfaces
Level: Harder than average
Course:
Exercise: Play any game, using an interface to create a common PLAY method.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Creating classes
Level: Harder than average
Course: Intermediate C#
Exercise: Play pairs: find identical owls in a grid by clicking, using classes.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Complex DataGridViews
Level: Harder than average
Course:
Exercise: Create a datagridview for mortgage applicants with a combobox bound to another table and a clickable button for each row.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Inheritance
Level: Harder than average
Course:
Exercise: Create labels and text boxes based on the same abstract class.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Complex DataGridViews
Level: Harder than average
Course:
Exercise: Create two linked forms, such that double-clicking on a record in a list on one form shows its details on another.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Arrays
Level: Harder than average
Course: Introduction to Visual C#
Exercise: Split array items into parts, extract dob, and find oldest person.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Data structures
Level: Harder than average
Course: Intermediate C#
Exercise: Use a Stack and two classes to play the Tower of Hanoi game.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: LINQ to SQL
Level: Harder than average
Course:
Exercise: Update and insert authors and delete a book using LINQ to SQL.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Grouping using LINQ
Level: Harder than average
Course: Intermediate C#
Exercise: Group (and reorder) films by studio using LINQ to SQL.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Coding form events
Level: Harder than average
Course: Introduction to Visual C#
Exercise: A his-and-hers form: choose your gender from a droplist, and a WebBrowser displays a relevant website.

Go to exercise ...

Software: Visual C#
Version: Any version of C#
Topic: Files and folders
Level: Harder than average
Course: Introduction to Visual C#
Exercise: Loop over all files/folders recursively to find biggest file.

Go to exercise ...

You can search our full list of C# exercises here.

This page has 0 threads Add post