Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problems with indexOf

1 view
Skip to first unread message

gh0st54

unread,
Oct 21, 2004, 12:03:10 PM10/21/04
to
hi

im'trying to validate that someone registering a new user does not
name im 'admin' or something like that

i'm using

bool bInvalidUsername = false;

bInvalidUsername = this.txtUserName.Text.ToLower().IndexOf("admin")>
-1 ?true:false;

but i always get
error: 'this.txtUserName.Text.ToLower' does not exist or a variant of
the message

?this.txtUserName.Text
"admin1234"
?this.txtUserName.Text.ToLower().IndexOf("admin")
error: 'this.txtUserName.Text.ToLower' does not exist
?this.txtUserName.Text.IndexOf("admin")
error: 'this.txtUserName.Text.IndexOf' does not exist

what am i doing wrong thanks

REMOVE @removeopenmymindremovemetoo.andmenet Karl Seguin

unread,
Oct 21, 2004, 12:28:42 PM10/21/04
to
That's a weird one. What version of the framework are you using? Are these
run-time or compile-time errors? I don't see anything inherently wrong with
what you are doing...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"gh0st54" <gh0...@hotmail.com> wrote in message
news:7fa3be06.04102...@posting.google.com...

bruce barker

unread,
Oct 21, 2004, 8:45:16 PM10/21/04
to
note: the debugger does not support string methods.

if you get these messages are runtime, then it means this.txtUserName.Text
is not a string. try:

bool bInvalidUsername =
this.txtUserName.Text.ToString().ToLower().IndexOf("admin") > -1 ? true :
false;

-- bruce (sqlwork.com)


"gh0st54" <gh0...@hotmail.com> wrote in message
news:7fa3be06.04102...@posting.google.com...

gh0st54

unread,
Oct 21, 2004, 9:11:46 PM10/21/04
to
HI

thanks for the reply

they are run-time in the immediate window in debug.

i found my problem which was not caused by the indexOf

but it's still weird that you get the error

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:<egwxTo4t...@TK2MSFTNGP15.phx.gbl>...

0 new messages