private void btnAddProvider_Click(object sender, EventArgs e) { using (var addProviderForm = new AddProviderForm()) { if (addProviderForm.ShowDialog() == DialogResult.OK) { var name = addProviderForm.ProviderName; var url = addProviderForm.ProvidedServiceURL; // Now write an XML file to the services... WriteProviderXml(name, url); // now refresh... InitForm(); } } }