Question

In: Computer Science

Write a Windows Form application named SumFiveInts. Microsoft Visual C#: An Introduction to Object-Oriented Programming,7th Edition....

Write a Windows Form application named SumFiveInts. Microsoft Visual C#: An Introduction to Object-Oriented Programming,7th Edition. Ch. 5, page 220. Take snip of program results.

Solutions

Expert Solution

Program:

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 SumFiveInts
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnCalculateSum_Click(object sender, EventArgs e)
{
int no1, no2, no3, no4, no5, sum;

//storing values from textboxes into variables
no1 = Convert.ToInt32(txtNo1.Text);
no2 = Convert.ToInt32(txtNo2.Text);
no3 = Convert.ToInt32(txtNo3.Text);
no4 = Convert.ToInt32(txtNo4.Text);
no5 = Convert.ToInt32(txtNo5.Text);

//calculating sum

sum = no1 + no2 + no3 + no4 + no5;

//storing the result in textbox i.e. txtSum
txtSum.Text = sum.ToString();


}

private void Form1_Load(object sender, EventArgs e)
{
//so the result can't be edit manually
txtSum.Enabled = false;
}
}
}

Output:

Note:

Button: btnCalculateSum

TextBox1: txtNo1

TextBox2: txtNo2

TextBox3: txtNo3

TextBox4: txtNo4

TextBox5: txtNo5

TextBox6: txtSum

Form : Form1


Related Solutions

This is from Microsoft Visual C#: An Introduction to Object Oriented Programming by Joyce Farrell (7th...
This is from Microsoft Visual C#: An Introduction to Object Oriented Programming by Joyce Farrell (7th Edition) The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program. /* The program requires the user to guess the number of days it takes to make X amount of money when doubling the value every day. The starting value is $0.01. The program indicates if the guess is too high, or too low. */ using System; using static...
C# Programming Discuss how to build a Multi-Form Windows application in C#. That is an App...
C# Programming Discuss how to build a Multi-Form Windows application in C#. That is an App that has more than one form, like say maybe 5 forms. How do you connect these forms and pass data objects between these forms?
I've created a C# Windows form application in Visual stuidos it allows the user to enter...
I've created a C# Windows form application in Visual stuidos it allows the user to enter information, save that information to a database, then show that information in a datagridview. Everything works fine but the datgridview. It shows that rows have been added but not the text. I can see in my database the reports that have been added so I know its alteast saving the information. I don't know what I'm doing wrong. Please help! My code: using System;...
In Object Oriented programming C++ : Write the appropriate functions for Student to neatly display a...
In Object Oriented programming C++ : Write the appropriate functions for Student to neatly display a Student, and then finally GPA. Have items neatly line up in columns. I need help creating a derived class called student that finds GPA (between 0.0 and 4.0) and credits completed (between 0 and 199).
C# Programming using Windows Form 1. Define a variable named isTrue that stores a value of...
C# Programming using Windows Form 1. Define a variable named isTrue that stores a value of whether something is true or false. Set this variable    to the negative. Output this variable to the txtIsTrue textbox. 2. Define a variable named favoriteGame that could store the name of a game. Set this variable's value to your favorite game. Output this variable to the txtFavoriteGame textbox. 3.. Define a variable named pi that can store real numbers. initialize it to a value...
C# Programming; Create a Windows Form Application that displays a scrollable list of 10 random integers...
C# Programming; Create a Windows Form Application that displays a scrollable list of 10 random integers in the range of 1 to 100. The form should also have (1) an Add button (and input textbox) for the user to add a new number to the list, (2) a Delete button to delete the current selected integer, (3) a Sort button to sort the list, (4) a Reverse button to display the list in reverse order, and (5) Display Multiple (and...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language - Visual Studio 2017 RESTAURANT MENU Write a program to place an order from the restaurant menu in Table 4.13. Use the form in Fig. 4.70, and write the program so that each group box is invisible and becomes visible only when its corresponding check box is checked. After the button is clicked, the cost of the meal should be calculated. (NOTE: The Checked...
Object-Oriented Design and Patterns in Java (the 3rd Edition Chapter 5) - Create a directory named...
Object-Oriented Design and Patterns in Java (the 3rd Edition Chapter 5) - Create a directory named as the question number and save the required solutions in the directory. - Each problem comes with an expected tester name. In the directory for a given problem, including the tester and all java classes successfully run this tester. Exercise 5.2 ObserverTester.java - Improve Exercise 1 by making the graph view editable. Attach a mouse listener to the panel that paints the graph. When...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax Application 1.1 Problem Statement Due to upcoming end of financial year, you are being called in to write a program which will read in a file and produce reports as outlined. Inputs: The input file called IncomeRecord.txt contains a list of Annual income records of employees in a firm. Each record is on a single line and the fields are separated by spaces. The...
Must be in Visual C# using windows forms : Create an application that opens a specified...
Must be in Visual C# using windows forms : Create an application that opens a specified text file and then displays a list of all the unique words found in the file. Hint: Use a LINQ method to remove all duplicate words.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT