How can I lock button in visual basic? I have a couple of buttons and there are some buttons that I would like to lock or disable after pressing it. How can I do that? I need an idea on using visual basic lock key. Can you tell me step by step tutorial? Thank you so much.
Idea on using visual basic lock key
In visual Basic there is a Button property like “Enabled”. You can use this in order to disable the button.
You can set it to ‘false’. If you need the button to be disabled after the button click you can write it inside the ‘button click’ event.
Here is the sample code that does this function.
btnSubmit.Enabled = False
btnReset.Enabled = False
Idea on using visual basic lock key
Hi,
Once one of my friends have faced same problem. I have found this solution from him.
You can make that button read only. Here is the variable track.
DimboolMakeReadOnly asBoolean= True
PrivateSubbtnSubmit_Click(ByValsender AsSystem.Object, ByVal e AsSystem.EventArgs) HandlesbtnSubmit. Click
IfboolMakeReadOnly ThenReturn'This exits the event
'Original code for the submit button (gets skipped if boolMakeReadOnly is true)
EndSub