当第一条记录输入后再输入一条记录与刚输入的一样,那么能成功,提示不能输入相同数据,但是添加第二天记录后再添加与第2条相同的记录也会提示,但是数据也被加入了。。为什么?以后的记录都是这样。。
dim i as integer
if input.text ="" then
msgBox "不能输入空"
elseif input.text=list. text then
msgBox "输入不能与已有记录相同"
else
if list.listcount=0 then
list.addRow input.text
else
for i=0 to list.listcount-1
if input.text = list.list(i) then
msgBox "不能输入与列表中相同的数据"
else
list.addRow input.text
list.cell(list.listcount-1,1)=help.text
save.enabled = true
end if
next
end if
end if
dim i as integer
if input.text ="" then
msgBox "不能输入空"
elseif input.text=list. text then
msgBox "输入不能与已有记录相同"
else
if list.listcount=0 then
list.addRow input.text
else
for i=0 to list.listcount-1
if input.text = list.list(i) then
msgBox "不能输入与列表中相同的数据"
else
list.addRow input.text
list.cell(list.listcount-1,1)=help.text
save.enabled = true
end if
next
end if
end if
Dim i As Integer
if input.text ="" then
MsgBox "不能输入空"
GoTo ExitHandler
End If
if input.text=list.text then
MsgBox "输入不能与已有记录相同"
GoTo ExitHandler
End If
If List.ListCount = 0 Then
list.addRow input.text
Else
For i = 0 To List.ListCount - 1
if input.text = list.list(i) then
MsgBox "不能输入与列表中相同的数据"
GoTo ExitHandler
Else
list.addRow input.text
List.cell(List.ListCount - 1, 1) = help.Text
save.Enabled = True
End If
Next
End If
ExitHandler:
dim i as integer
if input.text ="" then
msgBox "不能输入空"
elseif input.text=list. text then
msgBox "输入不能与已有记录相同"
else
if list.listcount=0 then
list.addRow input.text
else
dim norepeat
norepeat = true
for i=0 to list.listcount-1
if input.text = list.list(i) then
msgBox "不能输入与列表中相同的数据"
norepeat = false
end if
next i
if norepeat then
list.addRow input.text
list.cell(list.listcount-1,1)=help.text
save.enabled = true
end if
end if
end if
For i = 0 To List.ListCount - 1
if input.text = list.list(i) then
MsgBox "不能输入与列表中相同的数据"
exit for '<------------------------------------此处用跳出循环
Else
list.addRow input.text
List.cell(List.ListCount - 1, 1) = help.Text
save.Enabled = True
End If
Next