-
April 28th, 2013, 03:42 AM
#1
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();
}
-
April 28th, 2013, 06:01 PM
#2
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;
-
April 30th, 2013, 12:42 PM
#3
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.
Last edited by CM2013; April 30th, 2013 at 12:48 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|