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

Using Command buttons

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
GB
I have a form with 30 command buttons on, these are command1, command2 ..... etc. These buttons are only visible if there is a record in a file no 1 to 30. IE if record 1 exist command1 is visible, if record 2 exist command2 is visble etc. Is there some code where I can change a property on a command button by using a variable for the name.

eg I know the code below doesn't work but can I use something similar

select cp_squad
goto top
do while !eof()
nTMPNUM = CP_SQUAD.SYSREF
sCOMMANDBUT = "COMMAND" + STR(nTMPNUM)
THISFORM.sCOMMANDBUT.VISIBLE = .T.
enddo

 
Use macro substitution

E.G. lcCommand = "THISFORM.Command1.Visible = .T."

&lcCommand

This will make command button 1 visible.

*- Just a comment:

Use SCAN ENDSCAN iso DO WHILE !EOF(), it is much better...

HTH,
Weedz (Edward W.F. Veld)
My private project:Download the CrownBase source code !!
 
This will enabled your buttons:

....
sCOMMANDBUT = "COMMAND" + LTRIM( STR(nTMPNUM) )
THISFORM.&sCOMMANDBUT..VISIBLE = .T.
...

You may want to issue a Thisform.SetAll('Visible', .F., 'CommandButton')prior to your code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top