当前位置:首页>>网络编程>>VB教程>>正文

快速找到选中的OptionButton

文章出处:网络转载 作者:未知 发布时间:2006-07-28 收藏到QQ书签

OptionButton控件经常是作为控件数组存在的,要快速找到其中的哪一个被选中,可以使用下面的代码:

'假设控件数组包含3个OptionButton控件

intSelected=Option(0).Value*0-Option(1).Value*1-Option(2).Value*2

注意,因为第一个操作数总是0,所以上述代码可以精简如下:

intSelected=-Option(1).Value-Option(2).Value*2

->


Google