strFirstName = txtFirstName.Text;
strLastName = txtLastName.Text;
lblSummary = "FirstName:" + strFirstName + Environment.NewLine +
"Last Name:" + strLastName + Environment.NewLine +
"Gross Income:" + decGrossIncome.ToString("c") + Environment.NewLine +
"Taxes Due:" + decTaxesDue.ToString("c") + Environment.NewLine +
"Total Payments:" + decTotalPayments.ToString("c") + Environment.NewLine +
"Total Amount Due:" + decTotalAmountDue.ToString("c");
lblSummary.Text = strSummary;
*note*the following contains the error
"Total Amount Due:" + decTotalAmountDue.ToString("c");
The error I get is:
Error 1 Cannot implicitly convert type ‘string’ to ‘System.Windows.Forms.Label’ E:\CIS 162 AD\CS03\CS03\CS03\Form1.cs 79 37 CS03
You’re trying to assign a string value straight to a
Labelvariable. I suspect you meant this:I would personally advise using
string.Format, and ditching the pseudo-Hungarian naming by the way.