Question
In c# I am trying to get this code to display at the bottom in a windows form app in c#. It is giving me
In c#
I am trying to get this code to display at the bottom in a windows form app in c#. It is giving me the error that I cannot implicitly convert from a string to System.Windows.Forms.Label. Any suggestions as to how to fix this code so that it replaces what i have typed out as "lblResults = " into the text section of the label (currently no text is inside).
private void lblResults_Click(object sender, EventArgs e) { string name; string destination; string milesTraveledString; string gallonsConsumedString; double milesTraveled; double gallonsConsumed;
name = txtbxName.Text; destination = txtbxDestination.Text; milesTraveledString = txtbxDestination.Text; gallonsConsumedString = txtbxGallonsConsumed.Text; milesTraveled = double.Parse(milesTraveledString); gallonsConsumed = double.Parse(gallonsConsumedString);
lblResults = "Your name is: " + name + " Your Destination is: " + destination + " Your Miles Per Gallon for the trip will be: " + gallonsConsumed; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started