|
■No88920 (ブレーmen さん) に返信
VBですが参考までに
カウントはTextBox1に表示するようにしてあるので初期値を適当に
設定しておく必要があります。
多分提示された通りだと思うのですがbutton3を使用不可にした後、
戻していないのでカウントは1しか増えないと思います。
Public Class UserControl1
Public Event Event1 As EventHandler
Public Event Event2 As EventHandler
Public Sub Method1()
Button3.Focus()
Button2.Enabled = False
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Button2.Enabled = True
Button2.Focus()
Button3.Enabled = False
RaiseEvent Event1(Me, EventArgs.Empty)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
RaiseEvent Event2(Me, EventArgs.Empty)
End Sub
End Class
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Focus()
UserControl11.Method1()
Button1.Enabled = False
End Sub
Private Sub UserControl11_Event1(sender As Object, e As EventArgs) Handles UserControl11.Event1
TextBox1.Text = CInt(TextBox1.Text) + 1
End Sub
Private Sub UserControl11_Event2(sender As Object, e As EventArgs) Handles UserControl11.Event2
Button1.Enabled = True
End Sub
End Class
|