4
Good,
I have an Openfiledialog in my program, but I didn’t want when I "open" to appear what is in the image... If I close the window, it is "openfiledialog" in Textbox, and I want it to be empty, since nothing was selected.
Imagery:
Code:
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Request File (*.CSR)|*.csr|Configuration File (*.CNF)|*.cnf";
DialogResult resposta = openFileDialog1.ShowDialog();
if (resposta == DialogResult.OK)
{
string arquivo = openFileDialog1.FileName;
VariaveisGlobais.cnf = arquivo;
VariaveisGlobais.csr = label2.Text;
}
textBox3.Text = string.Format("{0}", openFileDialog1.FileName);
label2.Text = Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
button2.Enabled = Path.GetExtension(openFileDialog1.FileName) == ".cnf";
button3.Enabled = Path.GetExtension(openFileDialog1.FileName) == ".csr";
button4.Enabled = Path.GetExtension(openFileDialog1.FileName) == ".csr";
}