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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started