public DialogResult MyShowDialog() { btn_data.Enabled = DefaultFieldValues.ExtensionExists(settings.GetType().Name); document = DefaultDocument; lbl_docName.Text = Path.GetFileName(document); return(ShowDialog()); }
private void btn_data_Click(object sender, EventArgs e) { string type = settings.GetType().Name; DataRow row; foreach (Control c in this.panel.Controls) { if (!DefaultFieldValues.Exists(type, c.Name)) { continue; } if (c.GetType().Name == "TextBox") { ((TextBox)c).Text = DefaultFieldValues.Get(type, c.Name); continue; } // if c.GetType().Name = "DataGridView DataTable table = gridToTableMap[(DataGridView)c]; table.Clear(); foreach (string line in DefaultFieldValues.Get(type, c.Name).Split('\n')) { int i = 0; row = table.NewRow(); foreach (string v in line.Split(';')) { row[i++] = v.Trim(); } table.Rows.Add(row); } } }