如何在C#中切换按钮 [英] how to toggle a button in c#

查看:534
本文介绍了如何在C#中切换按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个datagridview.和一个按钮名称切换.在该特定数据网格中,有12行被命名为书名,类型,类别,作者,isbn,出版商名称,版本,数量,请求日期,预期日期,请求者和状态.

状态应进行处理和未处理.

现在我的问题是

当我单击切换按钮时,应在状态下处理选定的网格,再次当我单击相同的切换按钮时,应未处理相同的选定网格.


帮助我

i have one datagridview. and one button name toggle.in that particular data grid there are 12 rows named as booktitle,type,category,author,isbn,publishername,edition,quantity,requested date, expected date,requested by and status.

status should be processed and unprocessed.

now my question is

when i click toggle button,then selected grid should be processed in status ,again when i click same toggle button ,same selected grid should be unprocessed.


help me out

推荐答案

我不知道您所说的已处理"和未处理"是什么意思,但是如果我理解您的问题,听起来您需要保存按钮或网格的状态,这在您的应用程序中最有意义.您也许可以使用大多数对象都可以使用的Tag参数,也可以创建自己的变量.然后,每当单击按钮时,您都可以检查变量的状态,处理中"或未处理",并保存更改后的状态以供下次单击按钮使用.
I have no idea what you mean by "processed" and "unprocessed", but if I understand your problem, it sounds like you need to save the state of either the button or the grid, which ever makes most sense in your application. You can perhaps use the Tag parameter that''s available for most objects or you can create your own variable. Then whenever the button is clicked you can check the state of your variable, "process" or "unprocess," and save the changed state for next button click.


这篇关于如何在C#中切换按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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