account窗体的apply事件
Private Sub CmdApply_Click()
ComboUserLevel.ItemData(0) = 10
ComboUserLevel.ItemData(1) = 5
Dim Text1 As String
Dim Text2 As String
Dim Text3 As String
Dim Text4 As String
Dim x, y As Integer
Text1 = "<MMI CONFIG MODULE>"
Text2 = "--MMI Account-- :"
Text3 = "<PHONE CONFIG MODULE>"
Text4 = "Keypad Password :" & TextKeyboardPassword.Text
'columns(0)的替换模块
Dim FileNum As Long
FileNum = FreeFile
x = 0
While DataGrid1.ApproxCount <> 0 And x <> DataGrid1.ApproxCount
x = x + 1
Dim StrLine As String
Dim StrFileContent As String
Dim target As String
Dim target1 As String
Dim target2 As String
'获取用户输入的要查找的字符串
target = "Account" & x & " Name :"
target1 = "Account" & x & " Pass :"
target2 = "Account" & x & " Level :"
Open ".\Config.txt" For Input As #FileNum
Do Until EOF(FileNum)
Line Input #FileNum, StrLine
If StrLine <> "" Then
DataGrid1.Row = x - 1
If InStr(StrLine, target) > 0 Then StrLine = "Account" & x & " Name :" & DataGrid1.Columns(0).Text: target = "winline"
If InStr(StrLine, target1) > 0 Then StrLine = "Account" & x & " Pass :" & DataGrid1.Columns(2).Text: target1 = "winline1"
If InStr(StrLine, target2) > 0 Then
For y = 0 To ComboUserLevel.ListCount
If DataGrid1.Columns(1).Text = ComboUserLevel.List(y) Then
StrLine = "Account" & x & " Level :" & ComboUserLevel.ItemData(y): target2 = "winline2"
End If
Next y
End If
StrFileContent = StrFileContent & StrLine & vbCrLf
End If
Loop
Close #FileNum
StrFileContent = Left$(StrFileContent, Len(StrFileContent) - 2)
Open ".\Config.txt" For Output As #FileNum
Print #FileNum, StrFileContent
Close #FileNum
If target <> "winline" Then '没有找到了匹配字符串
Open ".\config.txt" For Append As #FileNum
DataGrid1.Row = x - 1
Print #FileNum, "Account" & x & " Name :" & DataGrid1.Columns(0).Text
End If
If target1 <> "winline1" Then
DataGrid1.Row = x - 1
Print #FileNum, "Account" & x & " Pass :" & DataGrid1.Columns(2).Text
End If
If target2 <> "winline2" Then
DataGrid1.Row = x - 1
For y = 0 To ComboUserLevel.ListCount
If DataGrid1.Columns(1).Text = ComboUserLevel.List(y) Then
Print #FileNum, "Account" & x & " Level :" & ComboUserLevel.ItemData(y)
End If
Next y
End If
Close #FileNum
Wend
Unload Account
End Sub
就是这段代码错了!!!!
那个stun窗体是对的,没有问题,我是想让你看看效果