error:cannot implicity string to label
i want to show my result on a lable which i want to use in a method of book class
Code:
class Book
{
Form1 newform = new Form1();
public string BookTitle;
public string BookAuthor;
public string PublishDate;
public const string Publisher = "MICROSOFT";
public void GetDetails()
{
// showing error here cannot implicity string to lable
newform.lbl_view_title = this.BookTitle;
}
}
private void btnMain_Click(object sender, EventArgs e)
{
CSharp.BookTitle = textBox1.Text;
CSharp.BookAuthor = textBox2.Text;
CSharp.PublishDate = textBox3.Text;
CSharp.GetDetails();
}
Re: error:cannot implicity string to label
I don't have access to look this up in msdn right now, but the label should have a Text property.
Code:
newform.lbl_view_title.Text = this.BookTitle;
Re: error:cannot implicity string to label
lol clearly you can only set it to its Text property. Label is a COntrol object.
Try pressing the . key next to the labelfield name. It shows you the Text property.