Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions