S
Sailor Foley
Hey,
using the OpenFileDialog class is causing me errors. Conside the
following code
private void method1()
{
OpenFileDialog open = new OpenFileDialog()
if(open.ShowDialog() == DialogResult.OK)
{
FileStream stream = new FileStream(pathName, etc, etc, etc)
//Do some actions
stream.Close()
method2()
}
}
private void method2()
{
FileStream stream = new FileStream(pathName, etc, etc, etc)
//Do some actions
stream.Close()
}
When i select a file using the OpenFileDialog in method 1 a thread
independant from the main thread becomes visible in the debugger.
This thread has a high priority. Using a Process object i can get to
this thread and it tell me that it's waiting for user input. This
thread is holding all access to the file "pathName" even after it's
closed. Therefore method2 can't open it.
Does anyone know why this happens and what to do about it as im unable
to abort this thread or kill it?
Thanks,
Clive
using the OpenFileDialog class is causing me errors. Conside the
following code
private void method1()
{
OpenFileDialog open = new OpenFileDialog()
if(open.ShowDialog() == DialogResult.OK)
{
FileStream stream = new FileStream(pathName, etc, etc, etc)
//Do some actions
stream.Close()
method2()
}
}
private void method2()
{
FileStream stream = new FileStream(pathName, etc, etc, etc)
//Do some actions
stream.Close()
}
When i select a file using the OpenFileDialog in method 1 a thread
independant from the main thread becomes visible in the debugger.
This thread has a high priority. Using a Process object i can get to
this thread and it tell me that it's waiting for user input. This
thread is holding all access to the file "pathName" even after it's
closed. Therefore method2 can't open it.
Does anyone know why this happens and what to do about it as im unable
to abort this thread or kill it?
Thanks,
Clive