本文介绍了如何让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文件创建者工作?
发布评论