Question

Programming question. Using Visual Studio 2019 Visual C# Assume a form contains two buttons named addButton...

Programming question. Using Visual Studio 2019 Visual C#

Assume a form contains two buttons named addButton and subButton. Both buttons click event procedures need to use the same variable which is a String variable named Employee. Write the appropriate statement to declare the Employee variable. Also specify where you will need to enter the statement and whether the variable is a procedure level or field level variable.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//C# program code that declares Employee variable of String type declared at procedure level

//Set the value to the addButton and subButton procedures

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

namespace WindowsFormsApplication
{
    public partial class Form1 : Form
    {
        //procedure level declaration of Employee variable of type String
        private String Employee = "Name";

        public Form1()
        {
            InitializeComponent();
        }

        private void addButton_Click(object sender, EventArgs e)
        {
            //Set Employee string to the nameLabel
            nameLabel.Text = Employee;

        }

        private void subButton_Click(object sender, EventArgs e)
        {
            //Set Employee string to the nameLabel
            nameLabel.Text = Employee;

        }
    }
}

Add a comment
Know the answer?
Add Answer to:
Programming question. Using Visual Studio 2019 Visual C# Assume a form contains two buttons named addButton...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code that assigns the...

    Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code that assigns the number 15 to the reward variable when the state variable contains the string “IL” (entered using any case) and the sales variable contains a number that is greater than 2000; otherwise, assign the number 5.

  • Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for...

    Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for program with ALL conditions met. Conditions to be met: Word Problem A person inherits a large amount of money. The person wants to invest it. He also has to withdraw it annually. How many years will it take him/her to spend all of the investment that earns at a 7% annual interest rate? Note that he/she needs to withdraw $40,000.00 a year. Also there...

  • C# Visual Studio Problem You are given a file named USPopulation.txt. The file contains the midyear...

    C# Visual Studio Problem You are given a file named USPopulation.txt. The file contains the midyear population of the United States, in thousands, during the years 1950 through 1990. The first line in the file contains the population for 1950, the second line contains the population for 1951, and so forth. Create an application that reads the file’s contents into an array or a List. The application should display the following data (statistics) in read-only textboxes. The average population during...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

  • Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code to display the message “Entry error” in the msgLabel when the value in the Integer units variable is less t...

    Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code to display the message “Entry error” in the msgLabel when the value in the Integer units variable is less than or equal to 0. Otherwise, calculate the total owed as follows: If the value stored in the units variable is less than 20, multiply the value by $10; otherwise, multiply it by $5. Store the total owed in the total variable.

  • The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language....

    The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language. The book ISBN number that I am using is: 978-1-285-08416-9 or the UPC code is: 2-901285084168-1. Question 1 Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program�s goal. Question 2 An application that has a Web user interface and runs on a server is called a(n) ____________________ application. Question 3...

  • using visual studio 2) For each of the following, write C++ statements that perform the specified...

    using visual studio 2) For each of the following, write C++ statements that perform the specified task.. (Ref: classwork named pointer2) a) Declare a built-in array of type unsigned int called values with five elements, and initialize the elements to the even integers from 2 to 10. b) Declare a pointer vPtr that points to a variable of type unsigned int. c) Write two separate statements that assign the starting address of array values to pointer variable vPtr. d) Use...

  • Visual Studio Code C# Well Document everyline saying what the code does. Include designer code and...

    Visual Studio Code C# Well Document everyline saying what the code does. Include designer code and .cscode Extra 6-1 Create a simple calculator In this exercise, you'l1 create a form that accepts two operands and an operator from the user and then performs the requested operation. Simple Calculator Operand 1: 86 Operator Operand 2 11.11 Resut 7.7408 1. Start a new project named SimpleCalculator in the Extra Exercises Chapter 06SimpleCalculator directory 2. Add labels, text boxes, and buttons to the...

  • C# for beginners (Methods and Properties, Data types) WorkStation:- Visual Studio 2019 Create a class called...

    C# for beginners (Methods and Properties, Data types) WorkStation:- Visual Studio 2019 Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables – a part number (type int), a part description (type string), a quantity of the item being purchased (type int) and a price per item (type decimal). Your class should have a constructor that initializes...

  • THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #inclu...

    THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) {    return bags * 30.0; } void displayMessage(void) {    cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() {    double bags = 0;    cout << "Enter the amount of checked bags you have." << endl;    cout <<...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT