KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
For some reason after my SaveFileDialog, my app will never show the MessageBox. Is there something I'm missing? Or is this a threading issue? I run the application as a Windows Form application using VS 2010 Express. I do not get any exceptions. To add: When I step through the code, all seems to go well. Which is weird, so I believe it is a timing issue. Pointed out by LarsTech and others, the MessageBoxes do show up, however the focus is gone; in other words the MessageBox is pushed behind other windows or minimized. This is a problem. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Globalization; using System.IO; namespace SpeedDating { class Program { [STAThread] static void Main(string[] args) { string filename = "test.test"; // args[0]; string ext = filename.Substring(filename.LastIndexOf('.')); SaveFileDialog dialog = new SaveFileDialog(); dialog.Title = "SpeedDating App"; dialog.RestoreDirectory = true; dialog.CheckFileExists = false; dialog.CheckPathExists = false; dialog.FileName = DateTime.Now.ToString("yyyyMMdd") + ext; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK && dialog.FileName != "") { try { FileStream outfs = File.Create(dialog.FileName); FileStream infs = File.Open(filename, FileMode.Open); infs.CopyTo(outfs); infs.Close(); outfs.Close(); } catch (NotSupportedException ex) { MessageBox.Show("Probably removed the original file."); } } else { MessageBox.Show("No path found to write to."); } MessageBox.Show("I came here and all I got was this louzy p
Tags (comma-separated)
Save Edits
Cancel