Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Adjust the code for the MilestoKilometre GUI converter on C#. If 'Convert' is clicked and there isn't a number in the text box (textBox1) the

Adjust the code for the MilestoKilometre GUI converter on C#. If 'Convert' is clicked and there isn't a number in the text box (textBox1) the output label must say 'Invalid input' instead of 'Distance in kilometres is ___' or 'Distance in miles is ___'

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

namespace Conver { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { label2.Text = ("Distance in kilometres is ___"); double i = Convert.ToDouble(textBox1.Text); label2.Text = "Distance in kilometres is " + Convert.ToString(i * 1.609344);

} if (radioButton2.Checked) {

double i = Convert.ToDouble(textBox1.Text); label2.Text = "Distance in miles is " + Convert.ToString(i / 1.609344); } }

private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) { label2.Text = ("Distance in kilometres is _"); } }

private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked) { label2.Text = ("Distance in miles is ___"); } }

private void textBox1_TextChanged(object sender, EventArgs e) { } } }

image text in transcribed

Miles and Kilometres Converter Miles to Kilometres Kilometres to Miles Enter distance:ietbeas) (textBoxl) Convert Distance in kilometres is

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago