8.Timerコントロール
(1) 動作
button1を押すと、5秒後、label1に"Hello World!"と表示される。
(2) Visual Basicの書き方
Private Sub button1_Click()
timer1.Interval = 5000
timer1.Enabled = True
End Sub
Private Sub timer1_Timer()
label1.Caption = "Hello World!"
timer1.Enabled = False
End Sub
(3) Visual J++の書き方
private void button1_click(Object source, Event e)
{
timer1.setInterval(5000);
timer1.start();
}
private void timer1_timer(Object source, Event e)
{
label1.setText("Hello World!");
timer1.stop();
}