c# - Why does this code generate a CS1525 ("invalid expression") compiler error? -


i'm trying make program that, when button pressed, takes words typed in text box , adds text file. have far:

private void textbox1_textchanged(object sender, eventargs e) {    file.writealltext(path, string()); }  private void textbox2_textchanged(object sender, eventargs e) {     file.writealltext(path, string()); } 

the string keeps coming error code cs1525 ("invalid expression"). doing wrong?

you want use string textbox.text property

for example

 file.writealltext(path, textbox1.text); 

or

 file.writealltext(path, (sender textbox).text); 

and sounds want create button , assign click event , use save text textbox file, , appendalltext may better option.

private void button1_click(object sender, eventargs e) {     file.appendalltext(path, textbox1.text); } 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -