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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 6 form won't release when ListView populated from within For/Next 1

Status
Not open for further replies.

jkshay

IS-IT--Management
Jan 14, 2004
2
US
I am experiencing frustration in trying to populate my ListView control at runtime and retain the ability to close my form. I have been able to duplicate my issue with a simplified project.

I have a form in VFP 6 with a ListView control and three buttons.

Button 1 is my "Quit" with simply a
Code:
this.parent.release
in the click method.
Buttons 2 and 3 populate my ListView control with the same data, but via different means.

Button2 click method contains code:
Code:
With This.Parent.OleListView.ListItems
	loListItem = .Add(,chr(34) + "1" + chr(34),"1")
	loListItem = .Add(,chr(34) + "2" + chr(34),"2")
	loListItem = .Add(,chr(34) + "3" + chr(34),"3")
EndWith

Button3 click method contains code:
Code:
for x=1 to 3
	With This.Parent.OleListView.ListItems
		KeyToAdd = chr(34) + allt(str(x)) + chr(34)
		TextToAdd = allt(str(x))
		loListItem = .Add(,KeyToAdd,TextToAdd)
	EndWith
next

my main.prg contains simply:
Code:
Do Form ListViewTest
Read Events

Both buttons will populate my ListView control correctly, but if I populate my ListView control using Button3 (with the For/Next loop), then my form doesn't disappear after clicking my "Quit" button. However, if I populate my ListView control using Button2 (hard coded values supplied), then my form will disappear when clicking the "Quit" button.

Any ideas before I run out of hair??
 
Mike-

Thanks for the information. Putting my For/Next inside my With/EndWith does make more sense, and setting my loListem to .NULL. did the trick! I had tried everything I could think of to no avail.

Thanks again for such a concise, speedy reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top