Click here to Skip to main content
15,908,768 members
Home / Discussions / C#
   

C#

 
GeneralRe: create a .csv file using a variable as the name Pin
Dave Kreskowiak13-Oct-07 5:08
mveDave Kreskowiak13-Oct-07 5:08 
GeneralRe: create a .csv file using a variable as the name Pin
mocasu13-Oct-07 5:25
mocasu13-Oct-07 5:25 
GeneralRe: create a .csv file using a variable as the name Pin
Guffa13-Oct-07 6:27
Guffa13-Oct-07 6:27 
GeneralRe: create a .csv file using a variable as the name Pin
DaveX8613-Oct-07 5:28
DaveX8613-Oct-07 5:28 
GeneralRe: create a .csv file using a variable as the name Pin
PIEBALDconsult13-Oct-07 5:31
mvePIEBALDconsult13-Oct-07 5:31 
GeneralRe: create a .csv file using a variable as the name Pin
Christian Graus13-Oct-07 10:33
protectorChristian Graus13-Oct-07 10:33 
AnswerRe: create a .csv file using a variable as the name Pin
Guffa13-Oct-07 5:51
Guffa13-Oct-07 5:51 
AnswerRe: create a .csv file using a variable as the name Pin
PIEBALDconsult13-Oct-07 4:33
mvePIEBALDconsult13-Oct-07 4:33 
System.IO.FileInfo fi = new System.IO.FileInfo
(
    string.Format
    (
        "{0:ddMMyyyy}_{1}_{2}.csv"
    ,
        System.DateTime.Now    
    ,
        "hi"
    ,
        123
    )
) ;

using ( System.IO.FileStream tw = fi.OpenWrite() )
{
...
}


However, I do suggest you format the date as "yyyyMMdd" to comply with ISO 8601.

Don't bother testing for file existence unless you want to read it, not write it.
The OpenWrite will create the file if it doesn't exist, and overwrite it if it does.
GeneralRe: create a .csv file using a variable as the name Pin
mocasu13-Oct-07 4:45
mocasu13-Oct-07 4:45 
GeneralRe: create a .csv file using a variable as the name Pin
PIEBALDconsult13-Oct-07 5:10
mvePIEBALDconsult13-Oct-07 5:10 
GeneralRe: create a .csv file using a variable as the name Pin
PIEBALDconsult13-Oct-07 5:19
mvePIEBALDconsult13-Oct-07 5:19 
GeneralRe: create a .csv file using a variable as the name Pin
mocasu13-Oct-07 5:27
mocasu13-Oct-07 5:27 
Questionlaunching programs from a windows service Pin
NikoTanghe13-Oct-07 3:29
NikoTanghe13-Oct-07 3:29 
AnswerRe: launching programs from a windows service Pin
Dave Kreskowiak13-Oct-07 4:10
mveDave Kreskowiak13-Oct-07 4:10 
QuestionHow to realize the smart indent in VC#? Pin
Seraph_summer13-Oct-07 3:01
Seraph_summer13-Oct-07 3:01 
AnswerRe: How to realize the smart indent in VC#? Pin
Steve Echols13-Oct-07 9:10
Steve Echols13-Oct-07 9:10 
Questionversion problem.. Pin
adilkazmi13-Oct-07 1:32
adilkazmi13-Oct-07 1:32 
AnswerRe: version problem.. Pin
pmarfleet13-Oct-07 1:50
pmarfleet13-Oct-07 1:50 
AnswerRe: version problem.. Pin
Dave Kreskowiak13-Oct-07 3:13
mveDave Kreskowiak13-Oct-07 3:13 
QuestionMenuStrip Pin
half-life13-Oct-07 1:17
half-life13-Oct-07 1:17 
AnswerRe: MenuStrip Pin
Dave Kreskowiak13-Oct-07 3:11
mveDave Kreskowiak13-Oct-07 3:11 
JokeRe: MenuStrip Pin
Anthony Mushrow13-Oct-07 3:38
professionalAnthony Mushrow13-Oct-07 3:38 
GeneralRe: MenuStrip Pin
half-life13-Oct-07 12:22
half-life13-Oct-07 12:22 
GeneralRe: MenuStrip Pin
Dave Kreskowiak13-Oct-07 15:12
mveDave Kreskowiak13-Oct-07 15:12 
GeneralRe: MenuStrip Pin
half-life13-Oct-07 19:06
half-life13-Oct-07 19:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.