vb.net中如何让循环每个值输出到txt,并在txt中让每行产生的循环值前加入固定的代码
ImportsSystem.IOPublicClassForm1PrivateSubButton1_Click(ByValsenderAsSystem.Object,By...
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Single
i = TextBox1.Text
For g As Integer = i To 1 Step -1
TextBox3.Text &= g & Environment.NewLine
Next
Dim filenameCreate As String
filenameCreate = "d:\" & TextBox2.Text & ".txt"
Dim sw As StreamWriter = New StreamWriter(filenameCreate)
sw.Write(TextBox3.Text)
sw.Flush()
sw.Close()
End Sub
End Class 展开
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Single
i = TextBox1.Text
For g As Integer = i To 1 Step -1
TextBox3.Text &= g & Environment.NewLine
Next
Dim filenameCreate As String
filenameCreate = "d:\" & TextBox2.Text & ".txt"
Dim sw As StreamWriter = New StreamWriter(filenameCreate)
sw.Write(TextBox3.Text)
sw.Flush()
sw.Close()
End Sub
End Class 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询