我有几个问题。是的,这是家庭作业,我只是想理解它。
这就是被问到的问题。
• When the button “Load” is clicked, read the file specified in the textbox (txtFilePath: Absolute path not relative) and add the objects found within to the listbox
• When the user clicks the “Save” button, write the selected record to the file specified in txtFilePath (absolute path not relative) without truncating the values currently inside
有人可以向我解释一下吗,因为我还在学习这个。我在那里有按钮和文本框,保存时也一样。现在使用保存按钮,我将拥有与您只想保存它时相同的代码。但是从我收集的信息来看,有一个数据库,因此您可以加载您保存的文件。还是我让它变得比实际更难了?
最佳答案
不,没有数据库。在这些说明中,record
== some selected item
需要附加到现有文件。只需使用流和写入器将文件保存到磁盘即可满足要求。
关于c# - 读取和写入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10284740/