private void bind_Parse(object sender, ConvertEventArgs e)
        {
            try
            {
                // Get the existing value from the object.
                Binding      binding       = (sender as Binding);
                string       boundProperty = binding.BindingMemberInfo.BindingField;
                object       datasource    = binding.DataSource;
                Type         controlType   = datasource.GetType();
                PropertyInfo pi            = controlType.GetProperty(boundProperty);
                object       oldValue      = pi.GetValue(datasource, null);

                // Convert to the desired type.
                string[] parts = e.DesiredType.ToString().Split('.');
                if (parts[0] != "System")
                {
                    throw new Exception("Cannot convert type '" + e.DesiredType.ToString() + "' - it is not a standard System type.");
                }

                Type       t  = Type.GetType("System.Convert");
                MethodInfo mi = t.GetMethod("To" + parts[1], new Type[1] {
                    typeof(string)
                });
                object newValue = mi.Invoke(null, new object[1] {
                    e.Value.ToString()
                });

                undoManager.AddState(binding.DataSource, boundProperty, oldValue, newValue);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Could not set undo state for object: " + ex.Message);
            }
        }