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); }