里面的一组中选择VB.NET默认的单选按钮 [英] VB.NET default radio button selected inside a group box

查看:72
本文介绍了里面的一组中选择VB.NET默认的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WinForms应用程序(VS 2008,.NET 3.5),有两个不同的组框形式,每个组框里面是不同组的单选按钮。当我运行应用程序,第一组框会自动在它的第一个单选按钮被选中,第二组框没有默认选中一个单选按钮。

I have a WinForms application (VS 2008, .NET 3.5) that has a form with two different group boxes, and inside of each group box are different sets of radio buttons. When I run the application, the first group box automatically has the first radio button in it already selected, and the second group box does not have a radio button selected by default.

我走过的单选按钮和组框所有属性看,并不能找出不同的是,两者之间有什么。我想这两个组框将所有单选按钮未选中时的形式第一次打开。

I have looked through all the properties of the radio buttons and the group boxes, and cannot figure out what the difference is between the two. I would like both group boxes to have all radio buttons unselected when the form is first opened.

另外,我看遍了Designer.vb文件的形式,并不能发现什么异常中有任何事情。

Also, I looked through the Designer.vb file for the form, and could not find anything unusual going on in there either.

推荐答案

我有这个问题了。我只是手动设置所有单选按钮对象.Checked =假的Form_Shown事件。需要注意的是它必须的的Form_Load事件,否则将无法正常工作,且单选按钮将使用默认设置。

I've had this issue, too. I just manually set all RadioButton objects to .Checked = False in the Form_Shown event. Note that it has to be after the Form_Load event or it won't work, and the RadioButton will be set with a default.

为什么呢?我不知道。在VB.NET可能存在的错误。

Why? I don't know. Perhaps a bug in VB.NET.

这篇关于里面的一组中选择VB.NET默认的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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