Little question

  • Thread starter Thread starter Roinem
  • Start date Start date
R

Roinem

Hi, to all..

I have a method that creates a Random File

And another method that open the notepad with this File

I dont know, but first of all i call to the first method.
after that i call to the second.. The program crash cause
the file exist a little time after the execution of the
second method...
Anybody could give me a hand?
Thanks in advance.
Roinem.
 
Roinem said:
I have a method that creates a Random File

And another method that open the notepad with this File

I dont know, but first of all i call to the first method.
after that i call to the second.. The program crash cause
the file exist a little time after the execution of the
second method...
Anybody could give me a hand?

Could you post a short but complete example which demonstrates the
problem? See http://www.pobox.com/~skeet/csharp/complete.html

My guess is that you're not closing the FileStream.
 
Hi...

Im using the FileInfo.Create() Method

First of all i generate a random file name and store in
one property of the class (string RandomFileName)...

And after that
i make this...

FileInfo MyFile=new FileInfo(this.RandomFileName)
MyFile.Create();

System.Diagnostics.Start
("iexplorer.exe",this.RandomFileName)


The File its empty, but should be existing...

When the program Open the internet explorer process with
the filename, this file is not already existing...

I will try use the FileStream....

Thanks Jon
Regards.
Roinem
 
MyFile.Create() returns a FileStream of the created file.

Try

FileStream fs = MyFile.Create();
fs.Close();
 
Back
Top