Click here to Skip to main content
15,894,539 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I don't have a problem but I;m asking you something on the in VB.net.

Well, I know, the 'Create' function is used to create a text file and the 'Append' function is used to append an existing text file.

I want to know that, if you create an application and include the 'Append' feature in the StreamWriter code, the build it (Deployment), if the text file does not exist on your computer, will the application create it even you have put 'Append' but not 'Create'?

I'm asking this as I have build an application where there is only 'Append' in my StreamWriter code, and the file does not exist on my computer, so when installing the application, it created a text file even I have not included 'Create' in my StreamWriter code.

So in brief, this means that apart from 'Create', the 'Append' also create a file when it does not exist then?
Posted

1 solution

If you try typing into your code, intellisense provides the answer:
Dim sw As New StreamWriter("F:\Temp\dummy.txt", True)
Place your cursor over the "True" and press CTRL+SHIFT+Space. Look at overload 4: string path, bool append. The text for append gives you a description of what happens when a file exists or not.
 
Share this answer
 
Comments
555336 30-Apr-11 11:11am    
I will not be able to implement it right now, but tell me, so Append also creates then even you have not put the Create in your code?
OriginalGriff 1-May-11 2:07am    
Correct.
555336 1-May-11 5:06am    
I have not yet known the StreamWriter functions that's why I asked this quiestion.

I find it cool then if Appen can create as we may not implement a code to know if the file exist do not create or if not exists, create. I mean we may not use both Create and Append when one of them is doing both jobs.

I have a problem on Deployment, can you help me here?

http://www.codeproject.com/Questions/189310/Setup-and-Deployment-in-VB-net.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900