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()
DataColumn keys=new DataColumn;
Each time the tick event of the Timer is fired we check a
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)
System.Random rnd=new System.Random();
bDisplayWord = !bDisplayWord;
To save and load the
DataSet I simply use the save and open dialogs combined with the
WriteXml Methods of the
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.