以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]多个RadioButton按钮,如何赋值?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=76816)

--  作者:文道古月
--  发布时间:2015/11/5 15:40:00
--  [求助]多个RadioButton按钮,如何赋值?
老师好,RadioButton按钮组合中,选中后如何赋值到某一列中?


图片点击可在新窗口打开查看此主题相关图片如下:radiobutton.png
图片点击可在新窗口打开查看


--  作者:大红袍
--  发布时间:2015/11/5 15:42:00
--  

Click是事件

 

Tables("表A").Current("第一列") = e.Sender.Text


--  作者:大红袍
--  发布时间:2015/11/5 15:44:00
--  

如果是按钮事件写,这样写

 

Dim str as String = ""

If e.Form.Controls("RadioButton1").Checked Then

    str = e.Form.Controls("RadioButton1").Text

Else If e.Form.Controls("RadioButton2").Checked Then

    str = e.Form.Controls("RadioButton2").Text

Else If e.Form.Controls("RadioButton3").Checked Then

    str = e.Form.Controls("RadioButton3").Text

End If

 

msgbox(str)


--  作者:文道古月
--  发布时间:2015/11/5 15:46:00
--  
那放在“保存数据”的click按钮中呢?如何加代码
--  作者:文道古月
--  发布时间:2015/11/5 15:46:00
--  
好的,谢谢
--  作者:文道古月
--  发布时间:2015/11/5 16:08:00
--  
红袍老师,代码加按钮事件,点击保存,还是没有值呀?

想达到的效果是,当选中某个单选框之后,点击“上传数据”(就是保存),可以保存,同时赋值到对应的表,列里面




图片点击可在新窗口打开查看此主题相关图片如下:radiobutton.png
图片点击可在新窗口打开查看


--  作者:大红袍
--  发布时间:2015/11/5 16:11:00
--  

Dim str as String = ""

If e.Form.Controls("RadioButton1").Checked Then

    str = e.Form.Controls("RadioButton1").Text

Else If e.Form.Controls("RadioButton2").Checked Then

    str = e.Form.Controls("RadioButton2").Text

Else If e.Form.Controls("RadioButton3").Checked Then

    str = e.Form.Controls("RadioButton3").Text

End If

 

r("第一列") = str