您好,我需要帮助将保存的数组写入 txt 文件,我完成了大部分作业,只是无法正确写入 txt 文件。
这是我的pdf和代码文件
https://drive.google.com/drive/folders/1WOcdFDWDKxd-RJstfL_hzPH8r_i0nKHI?usp=sharing
我有一个伙伴向我展示了如何在 C# 中做到这一点,但我主要在语法转换方面遇到了麻烦。
Private Sub partsForm_Load(sender As Object,
e As EventArgs) Handles Me.Load
'dim part as new list(of partstructure)
'List<partstructure> _partspart(txt/blabla/txt.txt)
' for each s as string in values
' lstofstrings.add(s.part, s.price, s.description)
' next
' sw.write(dr.part.tosring() + dr.price.tostring() +fnctionspace + dr.description);
' sw.close()
' sw.dispose()
' dim string as teststr = part.indexof = 0
' teststr = teststr.string.replace("", "")
' part.indexof(0) = teststr
' dim path as string = my.application.info.directorypath
' dim steramwriter as sw = new streamwriter (io.path.combine(path, "pdffile.pdf"), true)
'Load arrays and display part information when form opens
ChangeArraySize(3)
number(0) = "3827"
number(1) = "2871"
number(2) = "8671"
number(3) = "5986"
price(0) = "36.74"
price(1) = "3.21"
price(2) = "17.93"
price(3) = "9.21"
description(0) = "motor"
description(1) = "switch"
description(2) = "wire harness"
description(3) = "bearing"
Sort()
Display()
End Sub 'partsForm_Load
我希望能够完成 pdf 的要求并将我的数组的副本正确保存到 txt 文件中。