在线等,关于radiobutton应该怎样取值?
我想用radiobutton选择填写“性别”一项,radiobutton1的caption为“男”radiobutton2的caption为“女”,请问各位我该如何赋值?
table1.fieldvalues['性别']:=?

解决方案 »

  1.   

    if radiobutton1.Checked then table1.fieldvalues['性别']:='男'
    if radiobutton2.Checked then table1.fieldvalues['性别']:='女'
      

  2.   

    if radiobutton1.Checked then table1.fieldvalues['性别']:=radiobutton1.Caption
    if radiobutton2.Checked then table1.fieldvalues['性别']:=radiobutton2.Caption
      

  3.   

    RadioButton有一个checked的属性,选中时为真,反之为假。
    则:
      if RadioButton1.Checked then
        table1.fieldvalues['性别']:='男';
      if RadioButton2.Checked then
        table1.fieldvalues['性别']:='女';
      

  4.   

    难道你指望delphi给你包办一切吗?
    这样的问题,你自己写个if else不就完了吗?if RadioButton1.Checked then
    begin
      ...
    end
    else .......选择项比较多,你可以使用TRadioGroup控件,这个比较方便