Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code need fix
Message
From
03/06/2009 14:19:35
 
 
To
03/06/2009 05:15:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01403350
Message ID:
01403463
Views:
39
You had a typo in the < pre > tag so the formatting didn't come out correctly.

It's hard to figure out what you are trying to do, but there are things that clearly won't work as I think you intend.

assume that thisform.text5.value = "test5"
m.lcFileName = allTRIM(thisform.text5.value)+"a" + "." + laFiles(x)
means that m.lcFileName will become
test5a.pdf
test5a.tif
test5a.jpg
etc

LOCATE FOR  m.lcFileName = allTRIM(thisform.text5.value)+"b" + "." + laFiles(x)&&not work
1. You are doing a LOCATE in a table, but you aren't specifying anything in the table to check for. If your condition is true you will always be at the first record, otherwise you will always be at EOF(). You can never wind up at any other record.

2. You've set a condition that can never by true. For each iteration in the FOR-NEXT loop you are checking for
LOCATE FOR "test5a.pdf"  = "test5b.pdf" 
LOCATE FOR "test5a.tif"  = "test5b.tif" 
LOCATE FOR "test5a.jpg"  = "test5b.jpg" 
etc
In other words, conditions that can never be true so the value of FOUND() will always be FALSE and the values for Text9, Text10, and Text11 will never get updated.


>hi all,
>
>i need help to fix this code below
>
>
>SET DEFAULT TO "\\istweb-devlop\error\arttachment"
> 
>DIMENSION laFiles(8)
>laFiles[1] = "pdf"
>laFiles[2] = "tif"
>laFiles[3] = "jpg"
>laFiles[4] = "gif"
>laFiles[5] = "bmp"
>laFiles[6] = "doc"
>laFiles[7] = "docx"
>laFiles[8] = "rar"
>FOR x = 1 TO ALEN(laFiles)
>  m.lcFileName = allTRIM(thisform.text5.value)+"a" + "." + laFiles(x)
>  thisform.text8.Value=allTRIM(thisform.text5.value)+"a" + "." + laFiles(x)&& it works
> *************************************************************************************
> LOCATE FOR  m.lcFileName = allTRIM(thisform.text5.value)+"b" + "." + laFiles(x)&&not work
> IF FOUND()
>   thisform.text9.Value=allTRIM(thisform.text5.value)+"b" + "." + laFiles(x)
> endif
>
>LOCATE FOR  m.lcFileName = allTRIM(thisform.text5.value)+"c" + "." + laFiles(x)&&not work
> IF FOUND()
>   thisform.text10.Value=allTRIM(thisform.text5.value)+"c" + "." + laFiles(x)
> endif
>
>LOCATE FOR  m.lcFileName = allTRIM(thisform.text5.value)+"d" + "." + laFiles(x)&&not work
> IF FOUND()
>   thisform.text11.Value=allTRIM(thisform.text5.value)+"d" + "." + laFiles(x)
> endif
>
>
>
>******************************************************************************************
>    IF FILE(m.lcFileName)
>    EXIT
>  ENDIF
>ENDFOR
>
>
>
> If File(m.lcFileName)
>
> 	Declare Long ShellExecute In "shell32.dll" ;
> 		long HWnd, String lpszOp, ;
> 		string lpszFile, String lpszParams, ;
> 		string lpszDir, Long nShowCmd
> 
> 	lnResult = ShellExecute(0,'Open', m.lcFileName, 0,0,1)
> 	IF !(m.lnResult > 32) 
> 	endif
> Else
>
> 	MESSAGEBOX("not found")
> ENDIF
>
>
>
>thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform