文本文件“打印”从 VB6 开始在 VB.NET 中
我正在将应用程序从 VB6 移植到 VB.NET,但遇到了 VB.NET 不喜欢的情况。 “Print #”功能(无论其真实名称是什么)。代码如下:
Open tmp For Output As TmpNo
'save data from first form, frminput1
Print #TmpNo, frmInput1.txtTitle
Print #TmpNo, frmInput1.txtStrandWidth
Print #TmpNo, frmInput1.txtStrandThick
'MORE IS HERE, CUT DOWN BECAUSE IT'S TOO HEFTY
Close #TmpNo
我只是想知道 VB.NET 中的等价物是什么,因为有很多这样的东西,我不想在这里直到时间结束。 谢谢!
I'm porting an application from VB6 to VB.NET and have come across something that VB.NET doesn't like. The "Print #" function (whatever its real name is). The code is as follows:
Open tmp For Output As TmpNo
'save data from first form, frminput1
Print #TmpNo, frmInput1.txtTitle
Print #TmpNo, frmInput1.txtStrandWidth
Print #TmpNo, frmInput1.txtStrandThick
'MORE IS HERE, CUT DOWN BECAUSE IT'S TOO HEFTY
Close #TmpNo
I was just wondering what the equivalent of this in VB.NET is, as there is a LOT of this and I don't want to be here until the end of time.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用
Write
或WriteLine
方法写入文件...一些基本示例此处 和 此处
Use
Write
orWriteLine
method for writing a file...Some basic examples Here and Here
您应该使用 StreamWriter 类:
You should use the
StreamWriter
class instead:不如使用微软提供的功能,而不是胡编乱造。
打印、PrintLine 函数
将显示格式的数据写入顺序文件。
http://msdn.microsoft.com/en- us/library/9cksc646(v=VS.90).aspx
编程元素支持更改摘要
自 Visual Basic 6.0 以来,对各种编程元素的支持发生了变化,主要是为了与公共语言运行时的互操作性。许多 Visual Basic 6.0 元素被重命名、重新分类或与其他编程元素组合。不再支持某些元素,因为公共语言运行时 (CLR) 包含的功能使它们变得不必要。有关详细信息,请参阅公共语言运行时。
有关 Visual Basic 更改的其他信息,请参见针对 Visual Basic 6.0 用户的帮助。本主题包括有关集成开发环境 (IDE)、Web 功能、项目、表单、常量以及 Circle、Line 和 Pset 方法的更改的信息。
http://msdn.microsoft.com/en-我们/库/kaf4ssya(v=VS.90).aspx
How about using the functions provided by Microsoft instead of making stuff up.
Print, PrintLine Functions
Writes display-formatted data to a sequential file.
http://msdn.microsoft.com/en-us/library/9cksc646(v=VS.90).aspx
Programming Element Support Changes Summary
Support for various programming elements has changed since Visual Basic 6.0, mostly for interoperability with the common language runtime. Many Visual Basic 6.0 elements are renamed, reclassified, or combined with other programming elements. Several elements are no longer supported, because the common language runtime (CLR) includes functionality that makes them unnecessary. For more information, see Common Language Runtime.
For additional information about changes to Visual Basic, see Help for Visual Basic 6.0 Users. This topic includes information about changes to the integrated development environment (IDE), Web functionality, projects, forms, constants, and the Circle, Line, and Pset methods.
http://msdn.microsoft.com/en-us/library/kaf4ssya(v=VS.90).aspx