private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e) { try { GeneralNameHook hk = (GeneralNameHook)((ComboItem)comboBoxEx2.SelectedItem).Value; if (hk == GeneralNameHook.IP) { superValidator1.SetValidator1(textBoxX1, new DevComponents.DotNetBar.Validator.RegularExpressionValidator("Please type a valid IP Address", @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", false)); } else if (hk == GeneralNameHook.URI) { superValidator1.SetValidator1(textBoxX1, new DevComponents.DotNetBar.Validator.RegularExpressionValidator("Please type a valid URL", @"^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$", false)); } else if (hk == GeneralNameHook.email) { superValidator1.SetValidator1(textBoxX1, new DevComponents.DotNetBar.Validator.RegularExpressionValidator("Please type a valid Email", @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$", false)); } else { superValidator1.SetValidator1(textBoxX1, null); } } catch { } }
public GlobalName(GeneralNameHook hk, string value) { NameType = hk; if (hk == GeneralNameHook.dirName) { string sec = SectionManager.CreateSection("S"); SectionName = sec; Value = "dirName:" + sec; StringBuilder sb = new StringBuilder(); sb.AppendLine("[" + sec + "]"); foreach (string val in value.Split(',')) { sb.AppendLine(val); } SectionValue = sb.ToString(); SectionManager.DefineSectionFixed(sec, SectionValue); } else { Value = hk.ToString() + ":" + value; } }
ComboItem GetItem(GeneralNameHook tag, string name) { ComboItem cv = new ComboItem(); cv.Text = name; cv.Value = (int)tag; return(cv); }