简体   繁体   中英

Set both the name and location for writeline?

I want to set both the name and the location for a writeline procedure. I am allowing the user to select the path using a dialog box but can't seem to set both the name and location w/o getting an error. I am using VS 2010.

        strFileLocation = dlgFolderBrowser.SelectedPath

    Dim swrExportFile As New StreamWriter(strFileLocation)

Thanks in advance, Josh

I'm not 100% sure this is what you mean, but by name and location; do you mean filename and the directory the file will be in?

If so, you can pass it in as one to the StreamWriter:

Dim swrExportFile as New StreamWriter("C:\My\File\Location\" + "myFileName.txt")

也许saveFileDialog可能更适合此任务

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM