示例#1
0
        // begin with the list of functions of forms
        public void SaveTheForm(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Do you want to save?", "Save", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                // used to create GUIElements
                string GUIObjectName = ((Button)sender).Name;

                // update the DataSet with values of Fields
                DataSetUpdater DataSetUpdater = new DataSetUpdater();
                DataSetUpdater.AcceptDataSetChanges(GUIObjectName);
            }
        }
示例#2
0
        public void WriteFieldValueToDataSetRecord(object sender, EventArgs e)
        {
            string TextToSave    = "";
            string GUIObjectName = "";

            if (sender is TextBox)
            {
                TextToSave    = ((TextBox)(sender)).Text;
                GUIObjectName = ((TextBox)(sender)).Name;
            }
            // this two fields are login and password
            if (GUIObjectName == "field_1" || GUIObjectName == "field_2")
            {
                return;
            }

            // NEVER try to implemnt update of the DataGridView as a whole

            // update the DataSet with values of Fields
            DataSetUpdater DataSetUpdater = new DataSetUpdater();

            DataSetUpdater.WriteFieldToDataSetRecord(GUIObjectName, TextToSave);
        }