Howdy--
This could be just me, but I'm finding something odd working with an
EditField... I have an EditField ("BookcodeField", single line, no encoding
specified) where a user enters text and then in a PushButton, the text gets
checked for any weird characters that isn't allowed by a system I'm working
with. Here's the code:
[code]
dim c as integer
dim LegalCharacters as string
LegalCharacters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_"
if self.BookcodeField.text <> "" then
for c = 0 to len(self.BookcodeField.text)
if InStr(LegalCharacters, mid(self.BookcodeField.text, c, 1)) = 0 then
return ErrorMsgBox("The Bookcode field contains an illegal character.")
end if
next
else
return ErrorMsgBox("The Bookcode field needs an entry.")
end if
[/code]
When I enter a legal character InStr returns 0 regardless of how much text I
have in the editField. However, the following code works fine (I used this in
the previous version):
[code]
dim c as integer
dim IllegalCharacters as string
IllegalCharacters = "[EMAIL PROTECTED]&*()+={[}]|\:;<,>.?/~`'-"""
if self.BookcodeField.text <> "" then
for c = 0 to len(self.BookcodeField.text)
if InStr(IllegalCharacters, mid(self.BookcodeField.text, c, 1)) <> 0 then
return ErrorMsgBox("The Bookcode field contains an illegal character.")
end if
next
else
return ErrorMsgBox("The Bookcode field needs an entry.")
end if
[/code]
Is there some other invisible character I should be looking for? Or is there
some subtle bug in my code that I'm missing?
Thanks
--
Philip Regan
[EMAIL PROTECTED]
RB2K7r2, Mac OS 10.4.9, PowerPC G5
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>