Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6616929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:38:33+00:00 2026-05-25T20:38:33+00:00

strFirstName = txtFirstName.Text; strLastName = txtLastName.Text; lblSummary = FirstName: + strFirstName + Environment.NewLine +

  • 0
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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:38:34+00:00Added an answer on May 25, 2026 at 8:38 pm

    You’re trying to assign a string value straight to a Label variable. I suspect you meant this:

    string strSummary = "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;
    

    I would personally advise using string.Format, and ditching the pseudo-Hungarian naming by the way.

    string summary = string.Format("First Name: {1}{0}" + 
                                   "Last Name: {2}{0}" +
                                   "Gross Income: {3:c}{0}" +
                                   "Taxes Due: {4:c}{0}" +
                                   "Total Payments: {5:c}{0}" +
                                   "Total Amount Due: {6:c}",
                                   Environment.NewLine, firstName, lastName,
                                   grossIncome, taxesDue, totalPayments,
                                   totalAmountDue);
    
    // I'm not so hot on naming controls, so I'm not saying this is great - but I
    // prefer it not to be control-type-specific; what's important is that it's a
    // control we're using to output the summary.
    summaryOutput.Text = summary;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here are the declarations of the variables: string strFirstName; string strLastName; string strAddress; string
I have some problems with Eclipse, I have structure struct Account{ const char* strLastName;
- (void)setFirstName:(NSString*)firstNameValue { [self willChangeValueForKey:@firstName]; [firstName release]; firstName = firstNameValue; [firstName retain]; [self didChangeValueForKey:@firstName];
I have a small web form that user will enter some patient data and
can somebody please explain my mistake, I have this class: class Account { private:
I have taken over support of a VB .Net application that makes use of
Can somebody please explain the order of private and public in a class. Is
I have very technical question, I was working with C, and now I'm studying
I have this snippet of the code account.cpp #include account.h #include <iostream> #include <string>
I have one class called Person that basically looks like: public class Person {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.