예제 #1
0
        public void setValuesToUI(clsSampleClass objSample)
        {
            Type objType = objSample.GetType();

            for (int i = 0; i < objtextboxes.Count; i++)
            {
                PropertyInfo objProperty = objType.GetProperty(objPropertyInfo[i].ToString());
                ((TextBox)objtextboxes[i]).Text = objProperty.GetValue(objSample, null).ToString();
            }
        }
예제 #2
0
        public void setValuesToObject(clsSampleClass objSample)
        {
            // get the object type
            Type objType = objSample.GetType();

            // browse through all the UI object and set the object
            // from the UI to the corresponding property
            for (int i = 0; i < objtextboxes.Count; i++)
            {
                // get the UI object
                PropertyInfo objProperty = objType.GetProperty(objPropertyInfo[i].ToString());
                // set the object property from the UI object
                objProperty.SetValue(objSample, ((TextBox)objtextboxes[i]).Text, null);
            }
        }