如何让TXT文件创建者工作?

编程入门 行业动态 更新时间:2024-10-10 14:22:49
本文介绍了如何让TXT文件创建者工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Try Dim filePath As String filePath = System.IO.Path.Combine( My.Computer.FileSystem.SpecialDirectories.Desktop, My.Forms.Form1.TXTNAME.Text) My.Computer.FileSystem.WriteAllText(filePath, My.Forms.Form1.TXTTEXT.Text, False) Catch fileException As Exception Throw fileException End Try

我尝试过: 我试图弄乱一些属性,但没有一个可以工作。相反,它创建一个文件而不是TXT文件。

What I have tried: I tried to mess around with some properties but none of them work. Instead it creates a File rather than a TXT File.

推荐答案

您调用的TXT文件只不过是一个文件扩展名。除非您在TXTTEXT文本框中键入以.txt结尾的文件名,否则您将获得与键入文件名完全相同的文件名。代码不会自动添加.txt扩展名。你必须提供该代码。 The TXT file as you call it is nothing more than a file extension. Unless you type a filename that ends in ".txt" into the TXTTEXT textbox, you're going to get the filename exactly as you typed it. The code will NOT add the .txt extension automatically. YOU have to supply that code.

更多推荐

如何让TXT文件创建者工作?

本文发布于:2023-11-28 16:58:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643225.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建者   文件   工作   TXT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!