Foxtable(狐表)用户栏目专家坐堂 → 求对于多个单选框组合的遍历办法?


  共有2457人关注过本帖树形打印复制链接

主题:求对于多个单选框组合的遍历办法?

帅哥哟,离线,有人找我吗?
白面书生
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:38 积分:362 威望:0 精华:0 注册:2015/6/17 21:23:00
求对于多个单选框组合的遍历办法?  发帖心情 Post By:2015/6/28 22:33:00 [只看该作者]

如图所示,本人希望遍历第一个方框内,找出选中的值,再遍历第二个方框内选中的值,手册里面对这块描述的很少。求指点。
图片点击可在新窗口打开查看此主题相关图片如下:qq截图20150628223047.jpg
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
白面书生
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:38 积分:362 威望:0 精华:0 注册:2015/6/17 21:23:00
  发帖心情 Post By:2015/6/28 23:03:00 [只看该作者]

不用想了,我已经解决了,实现如下:

For Each c As Winform.Control In e.Form.Controls
        If Typeof c Is WinForm.RadioButton Then
            Dim t As WinForm.RadioButton = c
            If t.Name.StartsWith("targetRadio") And t.Checked Then
                dr2("工作目标评价") = t.Text
            Else If t.Name.StartsWith("countRadio") And t.Checked Then
                dr2("工作数量评价") = t.Text
            Else If t.Name.StartsWith("qualityRadio") And t.Checked Then
                dr2("工作质量评价") = t.Text
            Else
                dr2("工作表现评价") = t.Text
            End If
        End If
    Next


 回到顶部
帅哥哟,离线,有人找我吗?
狐作非为
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:456 积分:7267 威望:0 精华:0 注册:2012/2/6 12:27:00
  发帖心情 Post By:2015/6/28 23:15:00 [只看该作者]

我好像写的比你麻烦点
Dim tb As WinForm.TextBox = e.Form.Controls("TextBox1")
For Each c As WinForm.Control In e.Form.Controls
    If Typeof c Is WinForm.groupbox  Then 
        Dim t As WinForm.groupbox = c 
        For Each b As WinForm.RadioButton In t.Children
        If b.Checked =True
        tb.Value+= b.Text & Chr(13) & Chr(10)
        End If
        Next
    End If
Next

文本框是测试用
[此贴子已经被作者于2015/6/28 23:15:28编辑过]

 回到顶部