Question: Visual Studio C # I made a calculator, and now I have to make a calculator memory (event). There are 4 components here: one Textbox

Visual Studio C #

I made a calculator, and now I have to make a calculator memory (event).

There are 4 components here: one Textbox for the answer, two Buttons - "M" and "M+", and one Lable to display the answer again.

When the user clicks the M button, the contents of the Answer TextBox should be copied to a memory variable. Also make it so that when the user moves the mouse over the label, the value in the memory variable will appear in this label, and then disappear, when the mouse moves away from the label. Also add one more button, an M+ button. When the user clicks this button, the contents of the Results box will be added to Memory. You will need to use a Global Variable to store this data.

Below is my code:

private String ans; private Double answer; private Double answerPlus;

private void btnM_Click(object sender, EventArgs e) { ans = txtDisplay.Text; answer = double.Parse(ans);

}

private void lblblank_MouseEnter(object sender, EventArgs e) { lblblank.Show(); lblblank.Text = answer.ToString(); }

private void lblblank_MouseLeave(object sender, EventArgs e) { lblblank.Hide(); }

private void btnMPlus_Click(object sender, EventArgs e) { answerPlus = answer + double.Parse(ans);

}

My problem is that the label doesn't appear when the mouse over the label, and also it doens't disappear when the mouse leave the label. How can I fix it?

And also, is this way the right way to use the Global variable?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!