Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic Label
Message
From
01/03/2024 04:05:44
Kato Ba
Bytex Technologies Limited
Kaduna, Nigeria
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Dynamic Label
Miscellaneous
Thread ID:
01687658
Message ID:
01687658
Views:
103
Dear Colleagues,

The codes below throw "A member object with this name already exists." error on the second iteration. Please can someone be kind enough to point me in the right direction?
loForm = Createobject("Form")
loForm.Caption = "Dynamic Label Example"
loForm.Visible = .T.

CREATE CURSOR DynamicLabel (cDescript c(50))
INSERT INTO DynamicLabel (cDescript) VALUES ("Oustanding")
INSERT INTO DynamicLabel (cDescript) VALUES ("Very Good")
INSERT INTO DynamicLabel (cDescript) VALUES ("Good")
INSERT INTO DynamicLabel (cDescript) VALUES ("Fair")
INSERT INTO DynamicLabel (cDescript) VALUES ("Unsatisfactory")
INSERT INTO DynamicLabel (cDescript) VALUES ("Not Applicable")

GO TOP IN DynamicLabel 
i = 1
nTop = 10
Scan
** Add Label Control
  oLabel = "elbl"+Alltrim(Str(i))
  loForm.Newobject("oLabel", "Label")
  With loForm.oLabel
    .Top = nTop
    .Left = 10
    .Caption =Alltrim(cDescript)
    .Visible = .T.
    .AutoSize = .T.
  ENDWITH
  i = i + 1
  nTop = nTop + 20
Endscan
TIA
Alex Kato
Next
Reply
Map
View

Click here to load this message in the networking platform