private void btnBrowse_Click(object sender, EventArgs e) { DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) // Test result. { try { filename = openFileDialog1.FileName; this.userGroupCredentialsToLoad = ExcelMethods.GetData <UserGroupCredentialValues>(filename, "UserGroupCredentialValues"); MessageBox.Show("File read successful. Number of credentials to add to user Groups = " + userGroupCredentialsToLoad.Count, "Load successful", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); comboCredential.Enabled = false; comboApplication.Enabled = false; txtChangeDesc.Enabled = true; filePath.Text = filename; btnBrowse.Enabled = false; } catch (Exception ex) { MessageBox.Show("Exception - unable to read file.\n\nEnsure the file worksheet is called 'UserGroupCredentialValues' and has the required columns.\n\nException details:\n\n" + ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } }
private void btnBrowse_Click(object sender, EventArgs e) { DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) // Test result. { filename = openFileDialog1.FileName; filePath.Text = filename; this.userGroupsToLoad = ExcelMethods.GetData <DAUserGroups>(filename, "DAUserGroups"); MessageBox.Show("File read successful. Number of User Groups to create = " + userGroupsToLoad.Count, "File read complete", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtChangeDesc.Enabled = true; } }
private void btnBrowse_Click(object sender, EventArgs e) { DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) // Test result. { filename = openFileDialog1.FileName; filePath.Text = filename; this.credentialsToLoad = ExcelMethods.GetData <CredentialValues>(filename, "CredentialValues"); MessageBox.Show("File upload successful. Number of credential records to create = " + credentialsToLoad.Count, "Load successful", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtChangeDesc.Enabled = true; } }