internal void AddControl(FS.Data.Common.ConnKey oConnKey) { Label oLabel = new Label(); oLabel.Text = oConnKey.Key; oLabel.Left = (iLeft - 120); oLabel.Top = iTop; this.Controls.Add(oLabel); TextBox oTextbox = new TextBox(); oTextbox.Tag = oConnKey; oTextbox.Text = oConnKey.ToValueString(); oTextbox.Left = iLeft; oTextbox.Top = iTop; oTextbox.Width = 200; oTextbox.TabIndex = 0; if ("PASSWORD;PASS;PWS".Contains(oConnKey.Key.ToUpper())) { oTextbox.PasswordChar = char.Parse("*"); } oTextbox.TextChanged += Textbox_TextChanged; this.Controls.Add(oTextbox); iTop += 30; }
internal void Base_WizardValidating(ref bool Valid, ref string Msg) { try { foreach (Control oControl in this.Controls) { if (oControl.GetType() == typeof(TextBox)) { FS.Data.Common.ConnKey oConnKey = ((FS.Data.Common.ConnKey)oControl.Tag); if (oConnKey != null) { if (oConnKey.Required) { if (string.IsNullOrEmpty(oConnKey.ToValueString())) { Valid = false; Msg = oConnKey.Key + " is required"; oControl.Focus(); break; } } } } } if (Valid == true) { if (this.WizardValidating != null) { this.WizardValidating(ref Valid, ref Msg); } } } catch (Exception ex) { throw ex; } }
private void Textbox_TextChanged(object sender, EventArgs e) { FS.Data.Common.ConnKey oConnKey = null; TextBox oTextBox = null; try { oTextBox = ((TextBox)sender); oConnKey = ((FS.Data.Common.ConnKey)oTextBox.Tag); oConnKey.Value = oTextBox.Text; this.ConnItem.AddKey(oConnKey.Key, oConnKey.GetValue()); } catch { } finally { oConnKey = null; oTextBox = null; } }
internal bool isValid() { bool Valid = true; string Msg = string.Empty; try { foreach (Control oControl in this.Controls) { if (oControl.GetType() == typeof(TextBox)) { FS.Data.Common.ConnKey oConnKey = ((FS.Data.Common.ConnKey)oControl.Tag); if (oConnKey != null) { if (oConnKey.Required) { if (string.IsNullOrEmpty(oConnKey.ToValueString())) { Valid = false; Msg = oConnKey.Key + " is required"; oControl.Focus(); break; } } } } } if (Valid == true) { this.Validating(ref Valid, ref Msg); } } catch { Valid = true; } if (!Valid && !string.IsNullOrEmpty(Msg)) { MessageBox.Show(Msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(Valid); }