Usuário com melhor resposta
Upload

Pergunta
-
Respostas
-
Bom dia,
Você pode colocar um form button e então criar o evento para coleta do arquivo.void
private void buttonGetFile_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Text files | *.txt"; // file types, that will be allowed to upload dialog.Multiselect = false; // allow/deny user to upload more than one file at a time if (dialog.ShowDialog() == DialogResult.OK) // if user clicked OK { String path = dialog.FileName; // get name of file using (StreamReader reader = new StreamReader(new FileStream(path, FileMode.Open), new UTF8Encoding())) // do anything you want, e.g. read it { // ... } } }
Atenciosamente, Roberto Alves
- Sugerido como Resposta Cristopher C I_ segunda-feira, 29 de junho de 2015 13:35
- Marcado como Resposta Cristopher C I_ quarta-feira, 1 de julho de 2015 19:40
Todas as Respostas
-
Bom dia,
Você pode colocar um form button e então criar o evento para coleta do arquivo.void
private void buttonGetFile_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Text files | *.txt"; // file types, that will be allowed to upload dialog.Multiselect = false; // allow/deny user to upload more than one file at a time if (dialog.ShowDialog() == DialogResult.OK) // if user clicked OK { String path = dialog.FileName; // get name of file using (StreamReader reader = new StreamReader(new FileStream(path, FileMode.Open), new UTF8Encoding())) // do anything you want, e.g. read it { // ... } } }
Atenciosamente, Roberto Alves
- Sugerido como Resposta Cristopher C I_ segunda-feira, 29 de junho de 2015 13:35
- Marcado como Resposta Cristopher C I_ quarta-feira, 1 de julho de 2015 19:40
-