禁用按钮,然后启用 [英] disable button and then enable

查看:96
本文介绍了禁用按钮,然后启用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用excel和pdf生成报告
所以我用了2 btn

excel和pdf

单击时,excel btn报告将在excel中生成
然后单击pdf生成的pdf btn报告

在某些情况下,单击生成的btn excel或btn pdf报告,但如果用户单击两次btn excel或两次btn pdf应用程序挂起,则需要花费更多时间

所以我想要的是

单击btn excel或btn pdf时,都将btn禁用,直到在excel中生成报告,或者在生成报告后单击pdf,然后都启用btn.

i have generate report in excel and pdf
so i used 2 btn

excel and pdf

on click excel btn reports generate in excel
and on click pdf btn report generated in pdf

in some case on click btn excel or btn pdf report generated but takes some more time in that time if user click twice btn excel or twice btn pdf application hangs

so what i want is

on click btn excel or btn pdf both btn disable till report generated in excel or in pdf after report generated then both btn enable .

推荐答案

用于按钮的启用/禁用目的您可以将btn.Enabled属性用作-

btn.Enabled = false(用于禁用按钮控件)

btn.Enabled = true(用于启用按钮控件)
for Enable/Disable purpose of button you can use : btn.Enabled property as -

btn.Enabled = false (For disabling button control)

btn.Enabled = true(For Enabling button control)


在两个Button事件上均单击OnClick只是将可见性设置为false.


OnClick on both Button events just set the visibility to false..

as

excelBtn.Visible=false;
pdfBtn.Visible=false;


在两个按钮单击事件中都使用这两行.


Use these two lines in both of your button click events.


输入
onlick excel方法
excelbtn.visible = false
onclick pdf方法
pdfbtn.visible = false
put
onlick excel method
excelbtn.visible=false
onclick pdf method
pdfbtn.visible=false


这篇关于禁用按钮,然后启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆