Click here to Skip to main content
13,409,546 members (41,518 online)
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 22 Oct 2003


, 22 Oct 2003
Rate this:
Please Sign up or sign in to vote.
A simple educational flash card program that uses xml files for its word source


I was taking a Conversational Spanish course last year and a Microsoft course that required a lot of memorization and decided that the best way to learn a little more about C# was to create a Flash card program. The problem with most flash card programs are that you are stuck with their dictionaries and you can not adjust the pace.


The first thing was how would I store the data so that the maximum number of people could use the program with the least amount of software (aka: Access and SQL Server) so I decided to build the data schema in code and then save and open the DataSets as xml files.

This program demonstrates several useful techniques in using the System.Data namespace as well as the slider control and Timer.

Using the code

There are three forms frmAbout contains the version info and copyright notice, frmEditDict which is used to edit the dictionaries, and frmFlash which is the main form and displays the words and definitions.

To create the DataSet for the dictionary I used the following code.

static void initDS()
      //create our schema/table 
      ds=new DataSet("DataSet");
      DataTable dt=ds.Tables.Add("Dictionary");

      DataColumn dc=dt.Columns.Add("ID",typeof(Int32));

      //create the primary key
      DataColumn[] keys=new DataColumn[1];
      dc=dt.Columns.Add("Word",typeof( String));
      dc=dt.Columns.Add("Def",typeof( String));

Each time the tick event of the Timer is fired we check a boolean value bDisplayWord if it is true then we select another random word from the dictionary and display it. Then we toggle the bDisplayWord to false and display the definition the next time the Timer is fired.

private void timer1_Tick(object sender, System.EventArgs e)
      {// display word
        DataTable dt=ds.Tables[0];
        System.Random rnd=new System.Random();
        currentIndex=(Int32) (rnd.NextDouble()*dt.Rows.Count);
        DataRow dr;
      {//else display Definition
        txtDefinition.Text = 

      //switch display component
      bDisplayWord = !bDisplayWord;

To save and load the DataSet I simply use the save and open dialogs combined with the ReadXml and WriteXml Methods of the System.Data.DataSet class.

Points of Interest

This code was one of my first functional utilities written with C#. It demonstrates several objects of the .NET framework: DataSet, grids, sliders, xml files, Timers, and forms.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Paul J Barrett
Web Developer
United States United States
I have been programming since 1983 when I first programmed on a HeathKit 8088 Breadboard Computer in machine code. Since then I have dabbled with many things. I am extremely fluent with VB6, Access, Sql Server. I am currently programming a major project in C#.

I am also a system administrator for Unix, Linux, MS 4.0 - 2003 and also dabble with CISCO routers and firewalls.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 3 Pin
Member 1104862231-Aug-14 6:25
memberMember 1104862231-Aug-14 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180221.1 | Last Updated 23 Oct 2003
Article Copyright 2003 by Paul J Barrett
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid