1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37:
| delegate void Delegate_SetControlSafely(Control param_Control, String param_Property, Object param_Value);
private void SetControlSafely(Control param_Control, String param_Property, Object param_Value) { if (!CallBack_Deactivate) { if (param_Control.InvokeRequired) { Delegate_SetControlSafely Delegate = new Delegate_SetControlSafely(SetControlSafely); this.Invoke(Delegate, new object[] { param_Control, param_Property, param_Value }); } else { try { Type t = param_Control.GetType(); t.GetProperty(param_Property).SetValue(param_Control, param_Value, null); } catch { throw new Exception("Du hast versucht, eine nicht existierende Eigenschaft zu setzen."); } } } } |