private void button1_Click (object sender, System.EventArgs e) {try {object ds; string bindingField, propertyName; System.Data.DataRow dr = objdataSet.Tables [0] .NewRow (); foreach (Control cl in this.Controls) {foreach (System.Windows.Forms.Binding bd in cl.DataBindings) {bindingField = bd.BindingMemberInfo.BindingField; ds = bd.DataSource; propertyName = bd.PropertyName; Type myType = cl.GetType (); // Get the PropertyInfo object by passing the property name PropertyInfo myPropInfo = myType.GetProperty (propertyName);.. // Display the property name Console.WriteLine ( "The {0} property exists in MyClass.", myPropInfo.GetValue (cl, null)) DR [bindingfield] = mypropinfo.getValue (cl, null); //cl.database.remove (BD);}} Objdataset.Tables [0]. Rows.Add (DR);} catch (Exception Err) {Console .Writeline ("{0} Exception Caught.", Err.MESSAGE);
}