Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro app compiled as .exe freezing up! help!

Status
Not open for further replies.

tristero

Programmer
Jan 24, 2003
95
US
i have a project built as an *.exe

this project is essentially 1 main form.

every once in a while i try pressing one of the buttons to make it do something and it freezes (goes to an hourglass, when it shouldn't). it says it is running in the task manager but it never stops.

at first i thought it was an infinite loop mistake on my part but i can't see how that is possible.

this is driving me mad, please help! thank you

very simply, i am trying to trim any non alphanumeric chars from the beginning of each line of text.

some info regarding my app:

ShowWindow = 2 (As top-level form)
WindowType = 0 (modeless)
MDIForm = .F.

here is the click() event code that gets stuck:

Code:
cTrk = thisform.edit1.value
cTrkFinal = ""

FOR i = 1 TO MEMLINES(cTrk)
	m.line = ALLTRIM(MLINE(cTrk, i))
	
	DO WHILE !(ISALPHA(LEFT(m.line,1)))
		m.line = SUBSTR(m.line,2)
	ENDDO
	
	cTrkFinal = cTrkFinal+m.line+CHR(13)
ENDFOR

thisform.edit1.value = cTrkFinal



Dan Trenz
Ann Arbor, MI
 
Dan,
If m.line = "" && the null string, then the DO WHILE will go for ever!

Rick
 
right, would this fix it?
Code:
cTrk = thisform.edit1.value
cTrkFinal = ""

FOR i = 1 TO MEMLINES(cTrk)
	m.line = ALLTRIM(MLINE(cTrk, i))
	
	DO WHILE !ISALPHA(m.line) AND !EMPTY(m.line)
		m.line= SUBSTR(m.line,2)
	ENDDO
	
	cTrkFinal = cTrkFinal+m.line+CHR(13)
ENDFOR

thisform.edit1.value = cTrkFinal

or this..
Code:
cTrk = thisform.edit1.value
cTrkFinal = ""

FOR i = 1 TO MEMLINES(cTrk)
	m.line = ALLTRIM(MLINE(cTrk, i))
	
	DO WHILE !ISALPHA(m.line) AND !ISBLANK(m.line)
		m.line= SUBSTR(m.line,2)
	ENDDO
	
	cTrkFinal = cTrkFinal+m.line+CHR(13)
ENDFOR

thisform.edit1.value = cTrkFinal

Dan Trenz
Ann Arbor, MI
 
i think i fixed it.

Code:
DO WHILE !ISALPHA(m.line) AND !(LEFT(m.line,1)=="")
	m.line= SUBSTR(m.line,2)
ENDDO

not the prettiest code, but it seems to be working...

thanks rick

Dan Trenz
Ann Arbor, MI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top