Пример #1
0
        private void MultipleChoice_Load(object sender, EventArgs e)
        {
            string lijn;

            string[] velden = new string[1];
            string   fileName;

            AcceptButton = btnCheck;

            try
            {
                if (Vlaggen.AddWordsLanguage.EndsWith("Reversed"))
                {
                    fileName = Vlaggen.AddWordsLanguage.Substring(0, Vlaggen.AddWordsLanguage.Length - 9);
                }
                else
                {
                    fileName = Vlaggen.AddWordsLanguage;
                }
                StreamReader sr = new StreamReader(@"C:\Temp\WordList\" + fileName + ".txt");

                while (!sr.EndOfStream)
                {
                    lijn   = sr.ReadLine();
                    velden = lijn.Split(',');
                    EngPol engpol = new EngPol();
                    if (Vlaggen.AddWordsLanguage.EndsWith("Reversed"))
                    {
                        engpol.EngPolEnglish = velden[0];
                        engpol.EngPolPolish  = velden[1];
                    }
                    else
                    {
                        engpol.EngPolEnglish = velden[1];
                        engpol.EngPolPolish  = velden[0];
                    }
                    woordenLijst.Add(engpol);
                }
                sr.Close();
                if (woordenLijst.Count > 2)
                {
                    newWord();
                }
                else
                {
                    MessageBox.Show("Please add more words to this list");
                    this.Close();
                }
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show(ex.Message, "Fout");
            }
        }
Пример #2
0
        private void MultipleChoice_Load(object sender, EventArgs e)
        {
            string lijn;
            string[] velden = new string[1];
            string fileName;
               AcceptButton = btnCheck;

            try
            {

                if (Vlaggen.AddWordsLanguage.EndsWith("Reversed"))
                {
                    fileName = Vlaggen.AddWordsLanguage.Substring(0, Vlaggen.AddWordsLanguage.Length - 9);
                }
                else
                {
                    fileName = Vlaggen.AddWordsLanguage;
                }
                StreamReader sr = new StreamReader(@"C:\Temp\WordList\" + fileName + ".txt");

                while (!sr.EndOfStream)
                {
                    lijn = sr.ReadLine();
                    velden = lijn.Split(',');
                    EngPol engpol = new EngPol();
                    if (Vlaggen.AddWordsLanguage.EndsWith("Reversed"))
                    {
                        engpol.EngPolEnglish = velden[0];
                        engpol.EngPolPolish = velden[1];
                    }
                    else
                    {
                        engpol.EngPolEnglish = velden[1];
                        engpol.EngPolPolish = velden[0];
                    }
                    woordenLijst.Add(engpol);
                }
                sr.Close();
                if (woordenLijst.Count > 2)
                {
                    newWord();
                }
                else
                {
                    MessageBox.Show("Please add more words to this list");
                    this.Close();
                }
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show(ex.Message, "Fout");
            }
        }