Пример #1
0
        private void tsmiSaveAs_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            if (saveFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            // Saving text to file
            if (database == null)
            {
                database = new TrueFalse(saveFileDialog1.FileName);
                database.Add("123", true);
                database.Save();
                nudNumber.Minimum = 1;
                nudNumber.Maximum = 1;
                nudNumber.Value   = 1;
                MessageBox.Show("File saved");
            }
            else
            {
                database.FileName = saveFileDialog1.FileName;
                database.Save();
                MessageBox.Show("File saved");
            }
        }
Пример #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (database == null)
     {
         MessageBox.Show("Create new data base", "Message");
         return;
     }
     database.Add((database.Count + 1).ToString(), true);
     nudNumber.Maximum = database.Count;
     nudNumber.Value   = database.Count;
 }
Пример #3
0
        private void tsmiNew_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                database = new TrueFalse(sfd.FileName);
                database.Add("123", true);
                database.Save();
                nudNumber.Minimum = 1;
                nudNumber.Maximum = 1;
                nudNumber.Value   = 1;
            }
            ;
        }