SaveFileDIalog Bug

X

xucheng

When using the SaveFileDialog to overwrite an existing
file, I'm asked whether to replace the existing file.
I click the "Yes" button,System hang .

I'm using .Net Compact Framework sp2 .

my code is here.

private bool ActionSave(){
SaveFileDialog saveWav=new SaveFileDialog();
saveWav.Filter="Sounds (.wav)|*.wav|All Files|*.*";
saveWav.InitialDirectory=
OpenNETCF.EnvironmentEx.GetFolderPath(OpenNETCF.EnvironmentEx.SpecialFolder.Personal);
saveWav.FilterIndex=1;
DialogResult dl1=saveWav.ShowDialog();

if (dl1==DialogResult.OK){
if (saveWav.FileName.IndexOf(".")<0)
saveWav.FileName=saveWav.FileName+".wav";
File.Move(tmpFilename,saveWav.FileName);
return true;
}else{

return false;
}
}
 
P

Peter Foot [MVP]

If you have selected an existing filename, your File.Move statement will
attempt to overwrite the file, in your code following the dialog check with
File.Exists and if the file does exist delete or rename it first before
moving your file from it's temporary location.

Peter
 
X

xucheng

But system hang at line DialogResult dl1=saveWav.ShowDialog(); you can
remove the following source code and test it it, still hang .
 
X

xc

I found the reason ,

I have special code at the project beginning :

SetThreadPriority( (IntPtr)65, 1);


This line cause the SaveFileDialog can not work well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top