private void FrmQueryDateEdit_Load(object sender, EventArgs e) { this.lblFieldName.Text = this.FieldDisplayName; if (!string.IsNullOrEmpty(FieldDefaultValue)) { string[] itemArray = FieldDefaultValue.Split('~'); if (itemArray != null) { DateTime value; bool result = false; if (itemArray.Length > 0) { result = DateTime.TryParse(itemArray[0].Trim(), out value); if (result) { this.dtStart.DateTime = value; } } if (itemArray.Length > 1) { result = DateTime.TryParse(itemArray[1].Trim(), out value); if (result) { this.dtEnd.DateTime = value; } } } } this.dtStart.Focus(); }
private void FrmQueryNumericEdit_Load(object sender, EventArgs e) { txtStart.Text = ""; txtEnd.Text = ""; this.lblFieldName.Text = this.FieldDisplayName; if (!string.IsNullOrEmpty(FieldDefaultValue)) { string[] itemArray = FieldDefaultValue.Split('~'); if (itemArray != null) { decimal value = 0M; bool result = false; if (itemArray.Length > 0) { result = decimal.TryParse(itemArray[0].Trim(), out value); if (result) { this.txtStart.Value = value; } } if (itemArray.Length > 1) { result = decimal.TryParse(itemArray[1].Trim(), out value); if (result) { this.txtEnd.Value = value; } } } } this.txtStart.Focus(); }