Anusha Nanayakkara
2/23/2004 8:45:00 AM
Hi,
"name" may be use as a keyword. You better try with strName insted of "name" variable.
Anusha
>In the following code "fname" is a variable for a file name and "name" is a
> string variable. But when I use fname it does not contain the ".txt" part.
> Therefore I cannot create the file.
>
> private StreamWriter StartTracking(string name)
>
> {
>
> try
>
> {
>
> if(!Directory.Exists("Info"))
>
> Directory.CreateDirectory("Info");
>
> string fname = "Info\\" + DateTime.Now.ToString("ddMMyyHHmm")+ name+ ".txt";
>
>
> infowriter = new StreamWriter(new FileStream(fname,
> FileMode.OpenOrCreate,FileAccess.Write));
>
> return infowriter;
>
> }
>
> catch(Exception ev)
>
> {
>
> string msg = ev.Message;
>
> return null;
>
> }
>
> }
>
>
>
>
>
>
>
___
Newsgroups brought to you courtesy of www.dotnetjohn.com