BrightIdeasSoftware.ObjectListView.GetControlValue C# (CSharp) Method

GetControlValue() protected method

Return the value that the given control is showing
protected GetControlValue ( Control control ) : Object
control Control
return Object
        protected virtual Object GetControlValue(Control control)
        {
            if (control == null)
                return null;

            if (control is TextBox)
                return ((TextBox)control).Text;

            if (control is ComboBox)
                return ((ComboBox)control).SelectedValue;

            if (control is CheckBox)
                return ((CheckBox)control).Checked;

            try {
                return control.GetType().InvokeMember("Value", BindingFlags.GetProperty, null, control, null);
            } catch (MissingMethodException) { // Microsoft throws this
                return control.Text;
            } catch (MissingFieldException) { // Mono throws this
                return control.Text;
            }
        }
ObjectListView