Hello everyone, i'm a begginer in vb programation and i need to know how to really disable a button. The next example shows what i pretend to do... I have a form with 2 buttons and when i press the button 1, the button 2 should stay disabled for about 5 seconds. When i press the button 2 a message is shown.
The problem is that if i click in the secon button when it is disable, when he passes to enable, the message is shown. Seem that the event of clicking in the button 2 whaits for the button 2 pass to the enable state.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Button2.Enabled = False
'Me.Button2.Visible = False 'Me.Button2.SendToBack()System.Threading.Thread.Sleep(5000)
'Me.Button2.Visible = True 'Me.Button2.BringToFront() Me.Button2.Enabled = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'if Me.Button2.Enabled = True ThenMessageBox.Show(
"Message!!!") 'End If End SubEnd
Class
I also try to put the second button invisible and disable but when he passes to enable, the message is shown.
Sorry the errors...
Thank's