Example #1
0
        /// <summary>
        /// Attempts to fill a <code>Control.Text</code> value by finding the
        ///  member with the given name in the given HraObject.
        /// </summary>
        /// <param name="hraObject">object containing the data to set</param>
        /// <param name="name">name of field to search for</param>
        /// <param name="control">control to populate</param>
        private static void TryToSetControlValueFromHraObject(HraObject hraObject, string name, Control control)
        {
            FieldInfo hraField = hraObject.GetHraFieldWithNameLike(name);

            if (hraField != null)
            {
                object memberValue = hraField.GetValue(hraObject);
                if (memberValue is string)
                {
                    control.Text = memberValue as string;
                }
            }
        }