作者kimic (kimi)
看板Visual_Basic
标题Re: [.NET] 请问如何将变数内容写到.txt档
时间Sun Jul 22 00:19:22 2007
不知道这样是不是你要的..参考看看吧
※ 引述《a70103 (好想回台中....)》之铭言:
: 小弟我在写一个自动喂资料的程式
: 目前卡在不知道要如何将产生出来的值
: 写到txt档
: 例如我将档案放置在C:\data.txt
: 请问要如何写呢?
: 以下是我的程式码
: Public Class Form1
: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
: Dim Num() As String = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
: Dim i As Integer
: Dim a As String
: Dim data As FileAttribute
: data = FileAttribute.System
: Dim b As String
: Dim s As String
: Dim last As Integer
: b = "00000"
Dim srWriter As New System.IO.StreamWriter("c:\data.txt", False)
: For i = 0 To 100
: FileOpen(1, "c:\data.txt", OpenMode.Input)
: Randomize()
: s = (Int(5) * Rnd() + 1)
srWriter.WriteLine(s)
: a = b & Num(s)
: FileClose(1)
: Next
srWriter.Close()
: MsgBox("产生完毕")
: End Sub
: End Class
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.135.236.229
1F:推 a70103:感谢大大! 07/22 02:42