Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I could really use some help finishing this question I the code must be a GUI an

ID: 3871756 • Letter: I

Question

I could really use some help finishing this question

I the code must be a GUI and I can only figure out how to do it as a console application

The code must be in C# and must be a basic as possible because I am a beginner.

---------------------------------------------------------------------------

Use GUI for input and output. It is all your design.

(Find the Two Largest Number) The process of finding the maximum value (i.e., the largest of a group of values) is used frequently in computer applications.
For example, an app that determines the winner of a sales contest would input the number of units sold by each salesperson. The salesperson who sells the most units wins the contest.
Suggestion: first Write pseudocode, then a C# app that takes a user inputs: a series of 10 integers, then determines and displays the largest integer. <
Your app should use at least the following three variables: a) counter: A counter to count to 10 (i.e., to keep track of how many numbers have been input and to determine when all 10 numbers have been processed). b) number: The integer most recently input by the user. c) largest: The largest number found so far d) find the second largest value - for a full credit! e) [Note: You may input each number only once.]

What I want it to look like

textBox1 = textBox1

textBox2 = textBox2

textBox3 = textBox3

textBox4 = textBox4

textBox5 = textBox5

ect......

Button1 = Calculate

textbox11 = Result

Here is the code that I have so far. It is a console application and I need to turn this into a windows form. Please help

namespace EX2_Largest_Number
{
class Program
{
static void Main(string[] args)
{
int numbers = 0; // the place holder for numbers entered
int LargestNumber = 0; // place holder for the largest number value
int i = 0; // to implment the counter
for(i = 0; i < 10; i++) //counter skip 0 values
{
Console.WriteLine("Enter 10 numbers and then press the enter key");// command prompt
numbers = Convert.ToInt32(Console.ReadLine()); // to convert to decimal
//if ( counter == 0 LargestNumber > numbers;
//numbers = Convert.ToInt32(Console.ReadLine());

if (i ==0)
{
LargestNumber = numbers;// if zero is the largesrt value
}
else
{
if (numbers > LargestNumber)// to find the largest number entered
LargestNumber = numbers; }
}
// results
Console.WriteLine("{0:N} was the largest number that you entered. PRESS ENTER TO RESTART", LargestNumber);
Console.ReadLine();
Console.WriteLine("Press Enter to restart");

  

}
}
}

---------------------------------------

Thank you for your help!

Number Calculator Largest Number Calculator Please enter 10 numbers in the boxes below, and then click enter Calculate The Largest Number Entered was

Explanation / Answer

Program.cs:

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Chegg
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LargestNum());
}
}
}

LargestNum.cs

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

namespace Chegg
{
public partial class LargestNum : Form
{
public LargestNum()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int max = Int32.MinValue;
try
{
List<TextBox> lBoxes = GetTextBoxes();
foreach (TextBox tBox in lBoxes)
{
if (false == string.IsNullOrEmpty(tBox.Text))
{
int iBoxVal = Convert.ToInt32(tBox.Text);
if (iBoxVal > max)
{
max = iBoxVal;
}
}
}

if (max != Int32.MinValue)
{
textBox11.Text = max.ToString();
}
else
{
MessageBox.Show("Please enter some numbers to calculate");
}
}
catch (FormatException fx)
{
Console.WriteLine("button1_Click() Format Exception handled: " + fx);
MessageBox.Show("Please enter only numbers");
}
catch (Exception ex)
{
Console.WriteLine("button1_Click() Exception handled: " + ex);
MessageBox.Show(ex.Message);
}
}

private List<TextBox> GetTextBoxes()
{
List<TextBox> lst = new List<TextBox>();
try
{
foreach (Control ctrl in this.Controls)
{
if (ctrl is TextBox)
{
lst.Add((TextBox)ctrl);
}
}
}
catch (Exception ex)
{
Console.WriteLine("GetTextBoxes() Exception handled: " + ex);
}
return lst;
}
}
}

LargestNum.designer.cs

namespace Chegg
{
partial class LargestNum
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBox11 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(125, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(211, 20);
this.label1.TabIndex = 0;
this.label1.Text = "Largest Number Calculator";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(4, 53);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(444, 17);
this.label2.TabIndex = 1;
this.label2.Text = "Please enter 10 numbers in the boxes below, and then click Calculate";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(43, 101);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 2;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(266, 197);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 3;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(266, 246);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 20);
this.textBox3.TabIndex = 4;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(266, 305);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(100, 20);
this.textBox4.TabIndex = 5;
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(266, 155);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(100, 20);
this.textBox5.TabIndex = 6;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(266, 101);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(100, 20);
this.textBox6.TabIndex = 7;
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(43, 305);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(100, 20);
this.textBox7.TabIndex = 8;
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(43, 246);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(100, 20);
this.textBox8.TabIndex = 9;
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(43, 197);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(100, 20);
this.textBox9.TabIndex = 10;
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(43, 150);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(100, 20);
this.textBox10.TabIndex = 11;
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(149, 372);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(116, 31);
this.button1.TabIndex = 12;
this.button1.Text = "Calculate";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(103, 416);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(223, 18);
this.label3.TabIndex = 13;
this.label3.Text = "The largest number entered was ";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(165, 454);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(100, 20);
this.textBox11.TabIndex = 14;
//
// LargestNum
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(460, 502);
this.Controls.Add(this.textBox11);
this.Controls.Add(this.label3);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox10);
this.Controls.Add(this.textBox9);
this.Controls.Add(this.textBox8);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "LargestNum";
this.Text = "Number Calculator";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox11;
}
}

LargestNum.resx:

<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
  
Version 2.0
  
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
  
Example:
  
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
  
There are any number of "resheader" rows that contain simple
name/value pairs.
  
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
  
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
  
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
  
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
  
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote