- 积分
- 697
- 明经币
- 个
- 注册时间
- 2003-12-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
1,一个是定义数组mData的时候,如果不指定大小,提示未将对象引用设置到对象的实例 2,把aData中从右边取5个放入mData(k)z中,结果mData为空 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim myStream As FileStream Dim fso As New FileSystemObject Dim ts As TextStream Dim tso As TextStream Dim tsM As TextStream 'Dim sr As StreamReader = New StreamReader(TextBox1.Text) ts = fso.CreateTextFile(TextBox2.Text) tsM = fso.CreateTextFile(TextBox3.Text) tso = fso.OpenTextFile(TextBox1.Text) Dim iStr, jStr, kStr As String 'Dim Len As Long Dim i As Long Dim k As Integer = 0 Dim aData Dim mData(100) '如果不设置大小,提示未将对象引用设置到对象的实例
'/如果选择了源文件, If Not (TextBox1.Text Is Nothing) Then If Not (TextBox2.Text Is Nothing) Then aData = Split(tso.ReadAll, vbCrLf) For i = 39 To 65 Step 13 ts.WriteLine(aData(i)) ts.WriteLine(aData(i + 1)) ts.WriteLine(aData(i + 2)) Dim dlen As Integer dlen = Len(aData(i)) MsgBox(dlen)
'主要是这里 mData(k) = Microsoft.VisualBasic.Right(aData(i), 5) mData(k + 1) = Microsoft.VisualBasic.Right(aData(i + 1), 5) mData(k + 2) = Microsoft.VisualBasic.Right(aData(i + 2), 5) k = k + 3 MsgBox(mData(k)) ‘空白的
tsM.WriteLine(mData(k)) tsM.WriteLine(mData(k + 1)) tsM.WriteLine(mData(k + 2))
Next End If End If
|
|