创建选项组Create an option group

默认情况下,容器(如窗体、多页 或**框架) 上的所有选项按钮** 控件都属于单个选项组。By default, all OptionButton controls on a container (such as a form, a MultiPage, or a Frame) are part of a single option group. 这意味着,选择其中一个按钮会自动将窗体中的所有其他选项按钮设置为 FalseThis means that selecting one of the buttons automatically sets all other option buttons on the form to False.

如果希望窗体中包含多个选项组,可通过两种方法创建其他组:If you want more than one option group on the form, there are two ways to create additional groups:

  • 使用 " 属性名" 属性来标识相关按钮。Use the GroupName property to identify related buttons.

  • 将相关按钮放在窗体上的**Frame** 中。Put related buttons in a Frame on the form.

建议使用第一种方法而不是第二种方法,因为它可以减少应用程序中所需的控件数。The first method is recommended over the second because it reduces the number of controls required in the application. 这样便可减少应用程序所需的磁盘空间,并可改进应用程序的性能。This reduces the disk space required for your application and can improve the performance of your application as well.

备注

TabStrip 不是容器。A TabStrip is not a container. TabStrip 中的选项按钮包括在窗体的选项组中。Option buttons in the TabStrip are included in the form's option group. 可以使用 GroupName 通过 TabStrip 中的按钮创建一个选项组。You can use GroupName to create an option group from buttons in a TabStrip.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.