-
Save the information to string s
string s = "Title:"+ Panel Title text box. text + ","
Grade:"+ Panel Level drop-down menu. ","
Pages:"+ Panel Page text box. text + ","
Book Evaluation:"+ Panel to rate the text. text + ","
Remarks:"+ Panel Notes text. text + "。";
+ Panel Level drop-down menu. SelectedItem, when not selected, SelectedItem is empty.
Add before that.
if (panel level drop-down menu. selecteditem == null) {
Please select. ");
return;
Also: When the contents of the textbox are empty, the text property is"", there will be no null case.
-
Private void book collection button click(object sender, eventargs e).
Return to the path where the program is located.
string a = ;
Create a file to hold the data.
string b = a + ".dat";
if (!try will write try here, and then set a breakpoint here, it may be that the text is not filled in the data text value is null, null and characters may be connected to the operation may report an error, when debugging, the main thing is to see what the value of s is.
Save the information to string s
string s = "Title:"+ Panel Title text box. text + ","
Grade:"+ Panel Level drop-down menu. ","
Pages:"+ Panel Page text box. text + ","
Book Evaluation:"+ Panel to rate the text. text + ","
Remarks:"+ Panel Notes text. text + "。";
using (streamwriter t =
Write s to a file.
The save was successful");
Save failed");
Write try here, and then set a breakpoint here, it may be that the text is not filled in the data text value is null, null and characters may be connected to the operation may report an error, debugging mainly depends on what the value of s is.
Yes, fwrite is the same as c, but it can only be a file, not a directory. >>>More