1
I have that code:
DialogResult dr = ofd1.ShowDialog();
Moving to WPF does not work. I searched the internet and found nothing yet, that satisfy me. As I replace in WPF?
Note: ofd1 is a OpenDialog
1
I have that code:
DialogResult dr = ofd1.ShowDialog();
Moving to WPF does not work. I searched the internet and found nothing yet, that satisfy me. As I replace in WPF?
Note: ofd1 is a OpenDialog
0
Use the MessageResult
MessageBoxResult result = MessageBox.Show("Questão", "Título", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
// Fazer algo
}
0
That’s how it worked:
Nullable<bool> result = ofd1.ShowDialog();
if(result == true)
{
try
{
LocalizacaoZip = ofd1.FileName;
nome_arquivo_zip = System.IO.Path.GetFileNameWithoutExtension(ofd1.FileName);
}
catch (SecurityException ex)
{
}
catch(Exception ex)
{ }
}
0
How do you compare the Openfiledialog result? The code below works perfectly for me..
using System;
using System.Windows.Forms;
namespace TesteWpf {
class Program {
[STAThread]
static void Main(string[] args) {
using (OpenFileDialog ofd = new OpenFileDialog()) {
if (ofd.ShowDialog() == DialogResult.OK) {
}
}
}
}
}
For me it works on windows form, but it didn’t work on wpf.
Browser other questions tagged c# wpf
You are not signed in. Login or sign up in order to post.
This example I’ve seen on the internet and I couldn’t make it work for it.
– pnet
Didn’t get what? It gets hard to help without knowing what the problem is
– Jéf Bueno
That doesn’t work:
MessageBoxResult dr = ofd1.ShowDialog();
– pnet
You added the namespace
System.Windows
?– Jéf Bueno
The above code I posted comes from an Opendialog and that line I select the file I want to upload. With this example, I can’t open. That’s the problem I’m having. Yes I added the line. No error. It just doesn’t work as expected by this question.
– pnet