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
Post a Comment