Foxtable(狐表)用户栏目专家坐堂 → 选择RadioButton输入不同的表


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

主题:选择RadioButton输入不同的表

帅哥哟,离线,有人找我吗?
yangwenghd
  71楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2701 积分:17999 威望:0 精华:0 注册:2013/4/9 10:41:00
  发帖心情 Post By:2016/8/24 23:46:00 [只看该作者]

If e.Form.Controls("RadioButton1").checked Then
    Dim ndrb As DataRow = DataTables("表A").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
 ndrb("去向") = iif(e.Form.controls("RadioButton3").Checked,  e.Form.controls("RadioButton3").text,  e.Form.controls("RadioButton4").text)
 ndrb("来源") = iif(e.Form.controls("RadioButton3").Checked,  e.Form.controls("RadioButton3").text,  e.Form.controls("RadioButton4").text)
End If
If e.Form.Controls("RadioButton2").checked Then
    Dim ndrb As DataRow = DataTables("表B").AddNew
    ndrb("余额") = e.Form.controls("TextBox1").text
ndrb("提取处") = iif(e.Form.controls("RadioButton3").Checked,  e.Form.controls("RadioButton3").text,  e.Form.controls("RadioButton4").text)
 ndrb("去处") = iif(e.Form.controls("RadioButton3").Checked,  e.Form.controls("RadioButton3").text,  e.Form.controls("RadioButton4").text)
End If
If e.Form.Controls("RadioButton3").checked Then
    Dim ndrb As DataRow = DataTables("表A").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
ndrb("去向") = iif(e.Form.controls("RadioButton1").Checked,  e.Form.controls("RadioButton1").text,  e.Form.controls("RadioButton2").text)
 ndrb("来源") = iif(e.Form.controls("RadioButton1").Checked,  e.Form.controls("RadioButton1").text,  e.Form.controls("RadioButton2").text)
End If
If e.Form.Controls("RadioButton4").checked Then
    Dim ndrb As DataRow = DataTables("表B").AddNew
    ndrb("余额") = e.Form.controls("TextBox1").text
ndrb("提取处") = iif(e.Form.controls("RadioButton1").Checked,  e.Form.controls("RadioButton1").text,  e.Form.controls("RadioButton2").text)
 ndrb("去处") = iif(e.Form.controls("RadioButton1").Checked,  e.Form.controls("RadioButton1").text,  e.Form.controls("RadioButton2").text)
End If

还是不对,都输入进去了,
唉,还得麻烦你呀!
[此贴子已经被作者于2016/8/24 23:50:44编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
yangwenghd
  72楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2701 积分:17999 威望:0 精华:0 注册:2013/4/9 10:41:00
  发帖心情 Post By:2016/8/25 0:13:00 [只看该作者]

不能提取到Panel2 上 被选中的RadioButton 的名称吗? 通过写入Panel2代码 提取 被选中的名称

 回到顶部
帅哥哟,离线,有人找我吗?
Hyphen
  73楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/8/25 8:52:00 [只看该作者]

只能通过名称判断:

if e.Form.controls("RadioButtonXXX").Checked then

 回到顶部
帅哥哟,离线,有人找我吗?
yangwenghd
  74楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2701 积分:17999 威望:0 精华:0 注册:2013/4/9 10:41:00
  发帖心情 Post By:2016/8/25 12:33:00 [只看该作者]

可以通过TabControl1与TabControl2来判断吗?

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  75楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/25 13:45:00 [只看该作者]

 关键是没看懂你的逻辑啊。列出各种可能的效果。

 回到顶部
帅哥哟,离线,有人找我吗?
yangwenghd
  76楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2701 积分:17999 威望:0 精华:0 注册:2013/4/9 10:41:00
  发帖心情 Post By:2016/8/25 19:27:00 [只看该作者]

好的  麻烦了 
图片点击可在新窗口打开查看此主题相关图片如下:223.jpg
图片点击可在新窗口打开查看



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



 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:去项来向.table


[此贴子已经被作者于2016/8/25 20:01:54编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  77楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/26 0:39:00 [只看该作者]

If e.Form.Controls("RadioButton1").checked Then
    Dim ndrb As DataRow = DataTables("表B").AddNew
    ndrb("余额") = e.Form.controls("TextBox1").text
    ndrb("提取处") = e.Form.controls("RadioButton1").Text
End If
If e.Form.Controls("RadioButton2").checked Then
    Dim ndrb As DataRow = DataTables("表A").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("来源") = e.Form.controls("RadioButton2").Text
End If
If e.Form.Controls("RadioButton3").checked Then
    Dim ndrb As DataRow = DataTables("表B").AddNew
    ndrb("余额") = e.Form.controls("TextBox1").text
    ndrb("去处") = e.Form.controls("RadioButton3").Text
End If
If e.Form.Controls("RadioButton4").checked Then
    Dim ndrb As DataRow = DataTables("表A").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("去向") = e.Form.controls("RadioButton4").Text
End If


 回到顶部
帅哥哟,离线,有人找我吗?
yangwenghd
  78楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2701 积分:17999 威望:0 精华:0 注册:2013/4/9 10:41:00
  发帖心情 Post By:2016/8/26 9:15:00 [只看该作者]

感谢 感谢 是不是如果多加RadioButton就不能用这个代码了啊
 感谢 感谢 
图片点击可在新窗口打开查看此主题相关图片如下:duoge .jpg
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
Hyphen
  79楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/8/26 9:23:00 [只看该作者]

每多一个控件就要多一个判断的。楼上的还是花时间多看看编程基础吧。

如果一组多个RadioButton都是单选的,可以考虑使用组合框,不同判断那么多代码

 回到顶部
帅哥哟,离线,有人找我吗?
yangwenghd
  80楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2701 积分:17999 威望:0 精华:0 注册:2013/4/9 10:41:00
  发帖心情 Post By:2016/8/26 9:31:00 [只看该作者]

好难哦 
能再帮忙看看吗 
感谢 感谢 
If e.Form.Controls("RadioButton1").checked Then
    Dim ndrb As DataRow = DataTables("表A").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("去向") = e.Form.controls("RadioButton5").Text
End If
If e.Form.Controls("RadioButton2").checked Then
    Dim ndrb As DataRow = DataTables("表B").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("去处") = e.Form.controls("RadioButton6").Text
End If
If e.Form.Controls("RadioButton3").checked Then
    Dim ndrb As DataRow = DataTables("表C").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("去向") = e.Form.controls("RadioButton7").Text
End If
If e.Form.Controls("RadioButton4").checked Then
    Dim ndrb As DataRow = DataTables("表D").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("去项") = e.Form.controls("RadioButton8").Text
End If

If e.Form.Controls("RadioButton5").checked Then
    Dim ndrb As DataRow = DataTables("表A").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("来源") = e.Form.controls("RadioButton1").Text
End If
If e.Form.Controls("RadioButton6").checked Then
    Dim ndrb As DataRow = DataTables("表B").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("提取处") = e.Form.controls("RadioButton2").Text
End If
If e.Form.Controls("RadioButton7").checked Then
    Dim ndrb As DataRow = DataTables("表C").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("来源") = e.Form.controls("RadioButton3").Text
End If
If e.Form.Controls("RadioButton8").checked Then
    Dim ndrb As DataRow = DataTables("表D").AddNew
    ndrb("金额") = e.Form.controls("TextBox1").text
    ndrb("来源") = e.Form.controls("RadioButton4").Text
End If

只能得到指定的RadioButton名称 不是被选中的 ,

 回到顶部
总数 96 上一页 1 2 3 4 5 6 7 8 9 10 下一页