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

How to change a label caption

Status
Not open for further replies.

Jomercat

Programmer
Joined
Sep 1, 2004
Messages
100
Location
US
Hi all,

I have been programing in Visual Basic 6.0 and now I would like to start learning Visual Fox Pro 6.0. I have a simple quetion.

I have a form with a label, which I want to change its caption to, say "12345". So I added the following to the form load event "THISFORM.Label1.caption="12345", but it does not work. What am I doing wrong?

Any help would be appreciated.

Thanks in advance.

Jose.
 
Hi Jose,

In the form load event the label doesn't exist yet. Put the code in the init event which fires after all the form objects are instanciated.

Regards,

Mike
 
To elaborate a little on Mike's post, this is the chain of events for a VFP form:
The (blank) form gets created
Then all of the controls on the form get created
After which the controls' Init events fire
Then the form's Init event fires.

So if you're not initializing the caption in the form designer, you can either assign it a value in the form Init event as Mike said, or you can assign it a value in the label init event.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thanks guys for your reply. It worked.

Jose.
 
Jose,

Picking up on Dave Summer's post, the Help has a page on event firing sequences, with the title "Tracking Event Sequences" which I have always found very useful.


Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Remember LISA G :-) In Short
LOAD
INIT
Show
Activate
GotFocus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top