Reputation: 55
I'm creating a game in C# in Microsoft Visual C# express and I'm using the string label .Content and I seem to be getting an error on the program saying that there is no definition how can this be fixed?
//Label contents...
label1.Content = "100";
label2.Content = "200";
label3.Content = "300";
label4.Content = "400";
label5.Content = "500";
label6.Content = "800";
label7.Content = "1000";
label8.Content = "5000";
label9.Content = "8000";
label10.Content = "10000";
label11.Content = "15000";
label12.Content = "20000";
label13.Content = "30000";
label14.Content = "50000";
label15.Content = "60000";
label16.Content = "80000";
label17.Content = "100000";
label18.Content = "130000";
label19.Content = "160000";
label20.Content = "180000";
label21.Content = "200000";
i have to make it work with this
if ( label1.Container.ToString() == p)
{
label1.Content += " (lost)";
Upvotes: 0
Views: 216
Reputation: 18965
The System.Windows.Forms.Label
class doesn't have a property called Content
which is why you are receiving your compile error.
Just guessing at what you want to do with this I would say you're looking for Label.Text
.
Update:
I believe Content
is the common WPF equivalent (roughly) to Control.Text
in Winforms. If you got it to work before then you're either using a different set of controls or you're not using WinForms.
Upvotes: 1