I am a C# newbie and have encountered the following problem.
I have a class called Form1
which contains a number of controls in design view.
I have another class called Staff
which inherits from Form1
and which, amongst others, contains a method called PlayAll
that plays all the music notes played by the user on a music keyboard one after the other.
In the method PlayAll
, I have implemented a condition which determines whether a user pressed any notes or not.
If the user did not press any notes, an error message should be displayed in ErrorTextBox
(contained in Form1.cs).
This is the relevant code of PlayAll()
(in Staff.cs)
public void PlayAll()
{
ErrorTextBox.Text = "";
if (Pressed_Notes.Count == 0) //check if the user pressed a key
{
ErrorTextBox.Text = "There are no music notes to play!";
}
else
{
//Play the music notes
}
}
My problem is that nothing appears on the ErrorTextBox
(found in Form1.cs). How can I solve this problem please? Thanks.