void LoadDatabase(string filename) { database = new ArrayOfQuestions(filename); this.Text = filename; database.Load(); bindingSource.DataSource = database; bindingSource.DataMember = "List"; textBoxQuestionEdit.DataBindings.Add("Text", bindingSource, "Text"); checkBoxTrueOrFalse.DataBindings.Add("Checked", bindingSource, "Answer"); bindingNavigator1.BindingSource = bindingSource; }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "*.XML|*.XML"; if (openFileDialog.ShowDialog() == DialogResult.OK) { database = new ArrayOfQuestions(openFileDialog.FileName); this.Text = openFileDialog.SafeFileName; database.Load(); ButtinTrue();; textBoxQuestion.Text = database[0].Text; } }
private void создатьToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "*.XML|*.XML|Все файлы(*.*)|*.*"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { database = new ArrayOfQuestions(saveFileDialog.FileName); this.Text = saveFileDialog.FileName; bindingSource.DataSource = database; bindingSource.DataMember = "List"; textBoxQuestionEdit.DataBindings.Add("Text", bindingSource, "Text"); checkBoxTrueOrFalse.DataBindings.Add("Checked", bindingSource, "Answer"); bindingNavigator1.BindingSource = bindingSource; } }