以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]将多个分组框内的单选框的值赋值给当前行的不同列  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=154515)

--  作者:jjjeyes
--  发布时间:2020/9/16 22:56:00
--  [求助]将多个分组框内的单选框的值赋值给当前行的不同列
我有一个窗口A内有两个分组框,这两个分组框内分别有多个单选框,我希望选择分组框1内的1.2.3任意按钮的时候,把值填入到表B的甲列的当前行;而选择分组框2内的4.5.6任意按钮的时候把值填入到表B的乙列当前行。
请问前辈以上代码应该如何写?

--  作者:jjjeyes
--  发布时间:2020/9/17 0:45:00
--  
查了几个小时的帮助文件,我自己这样写的,不知道行不行

For Each c As object In e.Form.Controls(e.Form.Controls(e.sender.name).Parent.name).Children
    If Typeof c Is WinForm.RadioButton Then \'判断控件是否是单选框
        Tables("表A").Current(e.Form.Controls(e.sender.name).Parent.text) = e.sender.text
    End If
Next

以上代码写在窗口的全局代码click里。

--  作者:y2287958
--  发布时间:2020/9/17 8:13:00
--  
Select Case e.Sender.name
    Case "RadioButton1","RadioButton2","RadioButton3"
        Tables("表B").Current("甲列") = e.Sender.name
    Case "RadioButton4","RadioButton5","RadioButton6"
        Tables("表B").Current("乙列") = e.Sender.name
End Select