Re: for loops
- From: Tom <Tom@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Jan 2006 06:23:03 -0800
Matthew, as i read you post it came to me, i am really confused now. i am
checking a variable that is in a table (cpass). below is my code, i can see
why "I" will not change but now how do i fix it.
for i = 1 to 3
If cpass = alltrim(upper(this.value)) and !empty(this.value)
thisform.command1.enabled = .T. &&"ok" button to let them in
Thisform.refresh
Return
Else
messagebox(str(i)+" " +"Password does not match")
*This.value = space(34)
return
T = 0
Endif
i = i+1
next
Thisform.refresh
"Matthew L Reed" wrote:
> Post your actual code. If I is not changing, it's because you are resetting
> it in the loop somewhere, or because you have a table open with a field
> named i.
>
> Do this:
>
> i = 123
> ? i
> CREATE CURSOR zoot (i n(3))
> APPEND BLANK
> REPLACE i WITH 321
> ? i
> i = 999
> ? i
>
> Notice what happens when you set i to 999, and print it only to find that
> the value didn't appear to change to 999, but remained 321? Make sure there
> is no table/cursor with a field named i.
>
>
>
> "Tom" <Tom@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:6372167C-7C4F-4D99-808D-1FF5680F093A@xxxxxxxxxxxxxxxx
> > Lee, ok, then i must be doing something wrong, because i cant get the
> > Value
> > of "I" to change therefore allowing me to kick them out if "I" = 3
> >
> >
> > "Lee Mitchell" wrote:
> >
> >> Hi Tom:
> >>
> >> Works for me.
> >>
> >> for i = 1 to 3
> >> if this.value = cpass
> >> do something
> >> else
> >> WAIT window"message you cant get in"
> >> WAIT WINDOW STR(i)
> >> endif
> >> endfor
> >>
> >> I hope this helps.
> >>
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >> Sincerely,
> >> Microsoft FoxPro Technical Support
> >> Lee Mitchell
> >>
> >> *-- VFP9 HAS ARRIVED!! --*
> >> Read about all the new features of VFP9 here:
> >> http://msdn.microsoft.com/vfoxpro/
> >>
> >> *--Purchase VFP 9.0 here:
> >> http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
> >> 69-4500-8bf2-3f06689f4ab3&type=ovr
> >>
> >> Keep an eye on the product lifecycle for Visual FoxPro here:
> >> http://support.microsoft.com/gp/lifeselectindex
> >> - VFP5 Mainstream Support retired June 30th, 2003
> >> - VFP6 Mainstream Support retired Sept. 30th, 2003
> >>
> >> >Hey again. i am putting together a for loop. what i want to do is, give
> >> >a
> >> >user 3 trys to type in the correct password and if they dont i will kick
> >> them
> >> >out.
> >>
> >> >now, i have something written, but i cant get my value of (i) to
> >> >increase.
> >>
> >> >for i = 1 to 3
> >> > if this.value = cpass
> >> >do something
> >> >else
> >> >"message you cant get in"
> >> >endif
> >> >endfor
> >> >i know this isnt as i wrote it, so i know this dont work but you get the
> >> >idea.. any thoughts?
> >>
> >>
>
>
>
.
- Follow-Ups:
- Re: for loops
- From: Matthew L Reed
- Re: for loops
- References:
- RE: for loops
- From: Lee Mitchell
- Re: for loops
- From: Matthew L Reed
- RE: for loops
- Prev by Date: Re: Problem with parent-child grids
- Next by Date: RE: Mapping and access to a DLL on a server
- Previous by thread: Re: for loops
- Next by thread: Re: for loops
- Index(es):