在线等,关于radiobutton应该怎样取值?

hgxlucky 2003-06-11 05:33:36
在线等,关于radiobutton应该怎样取值?
我想用radiobutton选择填写“性别”一项,radiobutton1的caption为“男”radiobutton2的caption为“女”,请问各位我该如何赋值?
table1.fieldvalues['性别']:=?
...全文
77 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
rony 2003-06-11
  • 打赏
  • 举报
回复
难道你指望delphi给你包办一切吗?
这样的问题,你自己写个if else不就完了吗?

if RadioButton1.Checked then
begin
...
end
else .......

选择项比较多,你可以使用TRadioGroup控件,这个比较方便
ccbb1314 2003-06-11
  • 打赏
  • 举报
回复
RadioButton有一个checked的属性,选中时为真,反之为假。
则:
if RadioButton1.Checked then
table1.fieldvalues['性别']:='男';
if RadioButton2.Checked then
table1.fieldvalues['性别']:='女';
soaringsouth 2003-06-11
  • 打赏
  • 举报
回复
if radiobutton1.Checked then table1.fieldvalues['性别']:=radiobutton1.Caption
if radiobutton2.Checked then table1.fieldvalues['性别']:=radiobutton2.Caption
WWWWA 2003-06-11
  • 打赏
  • 举报
回复
if radiobutton1.Checked then table1.fieldvalues['性别']:='男'
if radiobutton2.Checked then table1.fieldvalues['性别']:='女'

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧