So I'm making a GUI program representing the functionality of a microwave control panel. I need help with programing the buttons that have the numbers assigned to them. So numbers 0 through 9. I have two labels, one for seconds and the other for minutes. I also have a button(cook time) that will clear whatever is in those labels and show 00 in both. Now when I click on the 1 button I want this to appear 00 01 , and then if I click the 6 button this should appear 00 16 , then when I click the 2 button this 01 62, then when I click 4 button this should appear 16 23. So it should be as if you were punching in on your microwave 16min 23sec. I also have a timer control set up to perform a countdown once the time is set. I kinda got the number thing to work but I'm way off I think.
here is my code:(using Microsoft visual C++ 2005 express edition)
#pragma endregion
private: System::Void start_Click(System::Object^ sender, System::EventArgs^ e) {
//Start button..starts the timer control
timer1->Enabled=true;
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
//performs the countdown
Int32 sec=Convert::ToInt32(seconds->Text);
Int32 min=Convert::ToInt32(minute->Text);
sec--;
seconds->Text=sec.ToString();
if(sec==-1)
{
min--;
minute->Text=min.ToString();
sec=59;
seconds->Text=sec.ToString();
}
if(min==-1)
{
timer1->Stop();
seconds->Text="Done";
}
}
private: System::Void stop_Click(System::Object^ sender, System::EventArgs^ e) {
//Stops the timer
timer1->Stop();
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
//number 1 button
System::String^ temp=seconds->Text;
seconds->Text="1"+temp;
}
private: System::Void button10_Click(System::Object^ sender, System::EventArgs^ e) {
//cook time button will clear labels and show 00 00
minute->Text="00";
seconds->Text="00 ";
}