By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,080 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,080 IT Pros & Developers. It's quick & easy.

Enable / Disable Button and using a timer to Enable a button and Erase data in TextBo

P: 2
Hey Guys, Im trying to figure out how to Disable a Button after a user clicks it, then Enable the Button if the user emptys a Text Box where the user can input information. I also want to automaticaly Enable the Button and clear the Text Box if the user doesn't do anything for a specified amount of time after clicking the Button. Any Help with this would be appreciated. Thanks
Mar 20 '07 #1
Share this Question
Share on Google+
2 Replies


100+
P: 149
Hey Guys, Im trying to figure out how to Disable a Button after a user clicks it, then Enable the Button if the user emptys a Text Box where the user can input information. I also want to automaticaly Enable the Button and clear the Text Box if the user doesn't do anything for a specified amount of time after clicking the Button. Any Help with this would be appreciated. Thanks
Hi ,

In the Button1_Click function write what ever what you need to execute and then at the end you can have the code "Button1.Enabled = False". This would disable the button after you clicked it.

Similarly in the Text1_Change() I think you can have this set of code

If Text1.Text = "" Then
Button1.Enabled = True
End If

See if this helps.

thanks
ansuman
Mar 20 '07 #2

debasisdas
Expert 5K+
P: 8,127
Hey Guys, Im trying to figure out how to Disable a Button after a user clicks it, then Enable the Button if the user emptys a Text Box where the user can input information. I also want to automaticaly Enable the Button and clear the Text Box if the user doesn't do anything for a specified amount of time after clicking the Button. Any Help with this would be appreciated. Thanks

Its so simple

TO DISABLE THE BUTTON
-----------------------------------------
in the button1_click() event
at the end specify button1.enabled=false

TO ENABLE IT BACK
--------------------------------------
in the textbox_change() event

if len(trim(text1.text))=0 then
button1.enable=true
end if

TO AUTOMATE
-----------------------------------
take one timer control
set interval to 5000 --if u wnat to exeute in 5 sec

in the timer1-timer() event

text1.text =""
button1.enbaled=true

and in the button click event

timer1.enabled =true


in form load


timer1.enabled=false


try this
hope it will work fine for u


regards
debasis
Mar 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.