Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Streamwriter to txt file from a text box in services

$
0
0

I am trying to create a WCF service that will enable me to write items (string,int,DateTime) from their respective text boxes into a text file. Also the result will return true when the input is successful and false when it failed. The following code is what i came up with.

- Am i using the streamwriter method correctly ?

- how do i point towards my textbox since this is being done in WCF service and web form is created separately ?

public bool person( String fruits, String juice_type,DateTime dateofpurchase, int qty); {

if (StreamWriter writer = new StreamWriter("jucie_store.txt", true)) { StreamWriter.WriteLine(TextBox1.Text); StreamWriter.WriteLine(TextBox2.Text); StreamWriter.WriteLine(TextBox3.Text); StreamWriter.WriteLine(TextBox4.Text); StreamWriter.WriteLine(TextBox5.Text); StreamWriter.WriteLine(TextBox6.Text);return true;

}else

{

return false;

} }




Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>