예제 #1
0
        private void btnOther_Click(object sender, EventArgs e)
        {
            var dlg = new OrganizationNameDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string organizationName = dlg.Organization;
                if (organizationName.Trim().Length == 0)
                {
                    ddlOrganization.SelectedIndex = 0;
                    return;
                }
                // add the organization if it's not already in the list
                if (!ddlOrganization.Items.Contains(organizationName))
                {
                    // not in our list - add it and select it
                    ddlOrganization.SelectedIndex = ddlOrganization.Items.Add(dlg.Organization);
                }
                else
                {
                    // already in our list - just select it
                    Organization = organizationName;
                }
            }
        }
 private void btnOther_Click(object sender, EventArgs e)
 {
     var dlg = new OrganizationNameDialog();
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         string organizationName = dlg.Organization;
         if (organizationName.Trim().Length == 0)
         {
             ddlOrganization.SelectedIndex = 0;
             return;
         }
         // add the organization if it's not already in the list
         if (!ddlOrganization.Items.Contains(organizationName))
         {
             // not in our list - add it and select it
             ddlOrganization.SelectedIndex = ddlOrganization.Items.Add(dlg.Organization);
         }
         else
         {
             // already in our list - just select it
             Organization = organizationName;
         }
     }
 }