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)";
The
System.Windows.Forms.Labelclass doesn’t have a property calledContentwhich 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
Contentis the common WPF equivalent (roughly) toControl.Textin Winforms. If you got it to work before then you’re either using a different set of controls or you’re not using WinForms.