Click here to Skip to main content
15,921,577 members
Home / Discussions / C#
   

C#

 
QuestionHow Can I Access the WAB with C# Pin
Member 9020256-Jun-04 20:24
Member 9020256-Jun-04 20:24 
AnswerRe: How Can I Access the WAB with C# Pin
Heath Stewart7-Jun-04 5:18
protectorHeath Stewart7-Jun-04 5:18 
GeneralCOM+ Word Object Error Pin
Member 3350226-Jun-04 20:15
Member 3350226-Jun-04 20:15 
QuestionHow to build my own database? Pin
fu06-Jun-04 17:04
fu06-Jun-04 17:04 
AnswerRe: How to build my own database? Pin
Aryadip6-Jun-04 20:31
Aryadip6-Jun-04 20:31 
AnswerRe: How to build my own database? Pin
Heath Stewart7-Jun-04 4:48
protectorHeath Stewart7-Jun-04 4:48 
GeneralExcel datetime Pin
Daniel Foo Chee Kwan6-Jun-04 16:25
Daniel Foo Chee Kwan6-Jun-04 16:25 
GeneralRe: Excel datetime Pin
Heath Stewart7-Jun-04 5:12
protectorHeath Stewart7-Jun-04 5:12 
QuestionHow do I get to the main form Pin
6-Jun-04 16:17
suss6-Jun-04 16:17 
AnswerRe: How do I get to the main form Pin
Stefan Troschuetz6-Jun-04 21:20
Stefan Troschuetz6-Jun-04 21:20 
GeneralRe: How do I get to the main form Pin
Member 9521757-Jun-04 1:58
Member 9521757-Jun-04 1:58 
GeneralRe: DataGrid Pin
myNameIsRon6-Jun-04 13:49
myNameIsRon6-Jun-04 13:49 
GeneralRe: DataGrid Pin
Charlie Williams6-Jun-04 14:42
Charlie Williams6-Jun-04 14:42 
GeneralRe: DataGrid Pin
myNameIsRon6-Jun-04 15:09
myNameIsRon6-Jun-04 15:09 
GeneralRe: DataGrid Pin
Dave Kreskowiak7-Jun-04 6:38
mveDave Kreskowiak7-Jun-04 6:38 
GeneralRe: DataGrid Pin
myNameIsRon8-Jun-04 11:22
myNameIsRon8-Jun-04 11:22 
GeneralSave a string in text file Pin
zlaty6-Jun-04 8:56
zlaty6-Jun-04 8:56 
GeneralRe: Save a string in text file Pin
Mazdak6-Jun-04 9:13
Mazdak6-Jun-04 9:13 
GeneralRe: Save a string in text file Pin
zlaty6-Jun-04 9:43
zlaty6-Jun-04 9:43 
GeneralRe: Save a string in text file Pin
Heath Stewart6-Jun-04 13:46
protectorHeath Stewart6-Jun-04 13:46 
What Mazdak said isn't completely right. In order to get the bytes for your string, you need to use an Encoding class like Encoding.ASCII and call the GetBytes(string) method to get the byte[] array ("buffer") that you write to a FileStream. If you use a TextWriter derivative, like the StreamWriter someone else mentioned, it does all this for you automatically. Just make sure to specify which encoding you want to use in the constructor:
using (StreamWriter writer = new StreamWriter("file.txt", true,
  Encoding.UTF8))
  writer.WriteLine("This is a single line.");
}
The using statement here makes sure that the StreamWriter is closed and all unmanaged resources (like file handles) are freed when the block of code is done - even in case of an exception.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Save a string in text file Pin
Heath Stewart6-Jun-04 13:47
protectorHeath Stewart6-Jun-04 13:47 
GeneralRe: Save a string in text file Pin
Peff6-Jun-04 10:20
Peff6-Jun-04 10:20 
GeneralRe: Save a string in text file Pin
zlaty6-Jun-04 10:34
zlaty6-Jun-04 10:34 
GeneralRe: Save a string in text file Pin
Heath Stewart6-Jun-04 13:43
protectorHeath Stewart6-Jun-04 13:43 
GeneralRe: Save a string in text file Pin
zlaty7-Jun-04 4:21
zlaty7-Jun-04 4:21 

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.