关于VB.NET的写入文件
一个空的.TXT文本文件.我现在想向这个TXT文件当中,写如下的内容:[0][0][1][1][2][2][3][3]...[n][n]以上应该怎么实现呢?如果可用,可以...
一个空的.TXT文本文件.
我现在想向这个TXT文件当中,写如下的内容:
[0]
[0]
[1]
[1]
[2]
[2]
[3]
[3]
...
[n]
[n]
以上应该怎么实现呢?
如果可用,可以再加30分!
谢谢! 展开
我现在想向这个TXT文件当中,写如下的内容:
[0]
[0]
[1]
[1]
[2]
[2]
[3]
[3]
...
[n]
[n]
以上应该怎么实现呢?
如果可用,可以再加30分!
谢谢! 展开
3个回答
展开全部
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim aa As System.IO.StreamWriter = New System.IO.StreamWriter("C:\a.txt", False, System.Text.Encoding.UTF8)
Dim i As Integer = 0
For i = 0 To Val(TextBox4.Text)
aa.WriteLine("[" & i & "]")
aa.WriteLine("[" & i & "]")
Next
aa.Close()
aa.Dispose()
End Sub
Dim aa As System.IO.StreamWriter = New System.IO.StreamWriter("C:\a.txt", False, System.Text.Encoding.UTF8)
Dim i As Integer = 0
For i = 0 To Val(TextBox4.Text)
aa.WriteLine("[" & i & "]")
aa.WriteLine("[" & i & "]")
Next
aa.Close()
aa.Dispose()
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
using writer as system.io.streamwriter = new streamwriter(filename.txt)
writer.writeline("[0]")
writer.writeline("[0]")
writer.writeline("[1]")
...
end using
writer.writeline("[0]")
writer.writeline("[0]")
writer.writeline("[1]")
...
end using
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Imports System
Imports System.IO
Class Test
Public Shared Sub Main()
Dim sw As StreamWriter = New StreamWriter("TestFile.txt")
Dim i As Integer
For i=0 To 100
sw.WriteLine("["&i&"]")
Next
sw.Close()
End Sub
End Class
Imports System.IO
Class Test
Public Shared Sub Main()
Dim sw As StreamWriter = New StreamWriter("TestFile.txt")
Dim i As Integer
For i=0 To 100
sw.WriteLine("["&i&"]")
Next
sw.Close()
End Sub
End Class
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询