Ejemplo n.º 1
0
        public static void D_GetDataFromTextBox(System.Windows.Forms.GroupBox fr, C1.Win.C1FlexGrid.C1FlexGrid vs)
        {
            if (vs.Row <= 0)
            {
                return;
            }
            try
            {
                for (int i = 0; i < fr.Controls.Count; i++)
                {
                    switch (fr.Controls[i].GetType().FullName)
                    {
                    case "C1.Win.C1Input.C1DateEdit":
                        C1.Win.C1Input.C1DateEdit dt1 = (C1.Win.C1Input.C1DateEdit)fr.Controls[i];
                        if (dt1.Tag + "" != "")
                        {
                            if (dt1.Value + "" == "")
                            {
                                vs.SetData(vs.Row, dt1.Tag + "", null);
                            }
                            else
                            {
//								if (dt1.CustomFormat!="" || dt1.CustomFormat!=null)
//									vs.SetData(vs.Row,dt1.Tag+"",Set_vs(DateTime.Parse(dt1.Value+"").ToString(dt1.CustomFormat)));
//								else
                                vs.SetData(vs.Row, dt1.Tag + "", Set_vs(dt1.Value));
                            }
                        }
                        break;

                    case "C1.Win.C1Input.C1TextBox":
                        C1.Win.C1Input.C1TextBox c1txt = (C1.Win.C1Input.C1TextBox)fr.Controls[i];
                        if ((c1txt.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, c1txt.Tag + "", Set_vs(c1txt.Value));
                        }
                        break;

                    case "System.Windows.Forms.TextBox":
                        TextBox txt = (System.Windows.Forms.TextBox)fr.Controls[i];
                        if ((txt.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, txt.Tag + "", Set_vs(txt.Text));
                        }
                        break;

                    case "System.Windows.Forms.CheckBox":
                        CheckBox chbox = (System.Windows.Forms.CheckBox)fr.Controls[i];
                        if ((chbox.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, chbox.Tag + "", Set_vs(chbox.Checked));
                        }
                        break;

                    case "System.Windows.Forms.ComboBox":
                        ComboBox cbbox = (System.Windows.Forms.ComboBox)fr.Controls[i];
                        if ((cbbox.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, cbbox.Tag + "", Set_vs(cbbox.SelectedValue));
                        }
                        break;
                    }
                }
                TextBoxAndVS.D_AddNewOrEdit(fr, (T_String.IsNullTo0(vs.Rows[vs.Row].UserData + "") != 2));
            }
            catch (Exception)
            {
                MessageBox.Show("Get data from VS error");
            }
        }