C#winform:复选框,按钮,代码 [英] C# winform : checkbox, button, code

查看:351
本文介绍了C#winform:复选框,按钮,代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hye ..我的程序是关于,我检查复选框并在我点击按钮后运行回收站程序,但我在运行程序时遇到错误。我如何解决这个问题呢?



谢谢



我尝试过:



Hye..my program is about, i check the checkbox and run the recycle bin program after i click the button, but i'm having the error when run the program. How do i actually solve that problem ?

thanks

What I have tried:

private void Button2_Click(object sender, EventArgs e)
       {

           checkBox1.Checked = SHEmptyRecycleBin(IntPtr.Zero, null, RecycleFlag.SHERB_NOSOUND | RecycleFlag.SHERB_NOCONFIRMATION);


       }

推荐答案

SHEmptyRecycleBin return integer (int) value





如果成功清空回收站然后返回0

如果回收站已经空了,你点击按钮然后返回值,如 -2147418113



所以,你需要相应地更改代码true false选中/未选中复选框



if successfully empty Recycle Bin then return 0
and if Recycle Bin already empty and you fire button click then return value like -2147418113

so, you need to change code accordingly true false for check box checked/unchecked


这篇关于C#winform:复选框,按钮,代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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