求诸位帮忙看一下代码哪里出错了
我想删除txt文件中的一行数据我在模块中定义:Public I21, I22, I23, I24 在窗体中用TextBox控件数组(A,B,C,D)给I21,I22,I23,I24 赋值。单击删除时 If A1(i, 1) <> I21 And A1(i, 2) <> I22 And A1(i, 3) <> I23 And A1(i, 4) <> I24 Then中的and好像不起作用了。跟or的作用相似。不知是哪里出了问题?删除单条记录应该怎么编写代码呀?我是vb6.0新手,还请各位前辈,哥哥,姐姐们多多赐教。
Private Sub 删除_Click()
Dim X, i As Integer
Open App.Path & "\shujv.txt" For Input As #1
i = 0
Do While Not EOF(1)
Line Input #1, X
i = i + 1
Loop
ReDim A1(i, 10) As String
Close #1
Open App.Path & "\shujv.txt" For Input As #1
i = 1
Do While Not EOF(1)
Input #1, A1(i, 1), A1(i, 2), A1(i, 3), A1(i, 4), A1(i, 5), A1(i, 6), A1(i, 7), A1(i, 8), A1(i, 9), A1(i, 10)
i = i + 1
Loop
Close #1
Open App.Path & "\shujv.txt" For Output As #1
For i = LBound(A1) To UBound(A1)
If A1(i, 1) <> I21 And A1(i, 2) <> I22 And A1(i, 3) <> I23 And A1(i, 4) <> I24 Then
Write #1, A1(i, 1), A1(i, 2), A1(i, 3), A1(i, 4), A1(i, 5), A1(i, 6), A1(i, 7), A1(i, 8), A1(i, 9), A1(i, 10)
End If
Next i
Close #1
For i3 = 1 To 17
If A.Item(i3).BackColor = RGB(20, 10, 255) Then
A.Item(i3).Text = ""
B.Item(i3).Text = ""
C.Item(i3).Text = ""
D.Item(i3).Text = ""
End If
Next i3
End Sub
[ 本帖最后由 爱的力量 于 2014-1-4 22:46 编辑 ]