Question
$10.00 Create a GUI application using Visual C# for miles per gallon
- From Computer-Science: Object-Oriented-Programming
- Closed, but you can still post tutorials
- Due on Feb. 14, 2009
- Asked on Feb 12, 2009 at 3:23:16PM
Q:
Create a GUI application using Visual C# that inputs miles driven and gallons used, and calculates miles per gallon. The example should use exception handling to process the FormatExceptions that occur when converting the strings in the TextBoxes to doubles. If invalid data is entered, a MessageBox should be displayed informing the user.
Help Creating a miles per gallon GUI application in C#
- This tutorial was purchased 1 time and rated No Rating by students like you.
- Posted on Feb 12, 2009 at 4:12:00PM
A:
Preview: ... ized by setting various properties associated with each control type. Here's how our default constructor is going to setup a Label control lblMilesDriven:<br><br><br><pre><br> // Sets up all the components in the GUI<br> private void MileageGUI()<br> {<br> . . .<br> //lblMilesDriven<br> this.lblMilesDriven.Location = new System.Drawing.Point(24, 32);<br> this.lblMilesDriven.Text = "Miles Driven";<br> . . .<br></pre><br><br><br><br>Here a Label control has two properties that we're interested in: Location and Text. The Location property specifies the x and y coordinates of the upper-left corner of this control relative to the main form. The Text property specifies what is displayed inside the Label.<br><br>A text box is configured similar to a label, as shown here:<br><br><br><pre><br> // txtMilesPerGallon<br> this.txtMilesPerGallon.Location = new System.Drawing.Point(152, 112);<br> this.txtMilesPerGallon.Text = "0";<br> // this TextBox will be read only since it will only display the result of a computation<br> this.txtMilesPerGallon.ReadOnly = true;<br></pre><br><br><br>Labels can't be edited by the user, but TextBox's can. TextBox has a new property called ReadOnly. If it is set to true then the user can select and copy the contents of the TextBox, but it cannot change it. By default they are editable (ReadOnly set to false).<br><br>The GUI we have in mind has three labels and three text boxes. Each Label says what is represented by a number in the neighboring textbox. The first two label/textbox pairs are going to be for the user input, and the final one is going to be for the calculat ...
The full tutorial is about 1215 words long plus attachments.
GUI application using Visual C#
- This tutorial hasn't been purchased yet.
- Posted on Feb 12, 2009 at 5:33:44PM
A:
Preview: ... numeric variables are m1, m2, and m3<br>The values read from the textboxes are converted to double by means of double. Parse (string)<br>and to ...
The full tutorial is about 278 words long plus attachments.

Fully-working VC# 2008 project with tutorial documentation
- This tutorial was purchased 2 times and rated A+ by students like you.
- Posted on Feb. 13, 2009 at 03:39:32AM
Posted by :
nzpapillon
Rating (558):A+
Questions Asked: 2
Tutorials Posted: 821,
Blog Posts: 1,
Earned: $22,893.55
Rating (558):A+
Questions Asked: 2
Tutorials Posted: 821,
Blog Posts: 1,
Earned: $22,893.55
A:
Preview: ... should be in your Visual C# IDE and load the project "MilePerGallonCalculator.csproj" in subfolder<br>" ...
The full tutorial is about 68 words long plus attachments.
