English 中文(简体)
我们怎样才能取消对无线电按钮的检查 [已关闭]
原标题:How can we uncheck a radio button [closed]
  • 时间:2012-05-22 08:15:44
  •  标签:
  • c#
  • .net
问题回答

使用以下代码使用无线电按钮作为复选框。

    bool isChecked =false;
    private void radioButton1_CheckedChanged(object sender, EventArgs e)
    {
        isChecked = radioButton1.Checked;
    }

    private void radioButton1_Click(object sender, EventArgs e)
    {
        if (radioButton1.Checked && !isChecked)
            radioButton1.Checked = false;
        else
        {
            radioButton1.Checked = true;
            isChecked = false;
        }
    }

当您想要用户从一系列选项中选择一个或多个项目时, 通常会使用无线电按钮, 所以到最后, 您将至少有一个选中的项目。 如果您想要让用户不检查, 那么, 您应该首先真的使用复选框 。

最多情况下,您可以提供一些功能,例如 重新设置 无线电按钮的按钮,例如 rdBtn. checked = fraud;

这也许可以:

private void radio_click(object sender, EventArgs e)
{
  if (radio.Checked)
  {
    radio.Checked = false;
  }
}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签