注册 登录
编程论坛 Delphi论坛

RadioGroup控件的一个小问题

mis123 发布于 2010-04-29 16:38, 830 次点击
初学者问个问题,怎么获得radiogroup控件中,所选中的是第几行,(RadioGroup1.Items[?])


[ 本帖最后由 mis123 于 2010-4-29 16:39 编辑 ]
3 回复
#2
2010-04-29 20:11
不明白。
#3
mis1232010-04-29 21:39
回复 2楼 SunQuan99
在RadioGroup1的OnClick事件里实现:点击某一个表名,显示该表的数据   
   self.ADOQryView.SQL.Add('select *');
   self.ADOQryView.SQL.Add('from'+' '+RadioGroup1.Items[**]);
   self.ADOQryView.Active:=True;

RadioGroup里有内容:
class
students
score

那么RadioGroup1.Items[0]的内容就是class;RadioGroup1.Items[1]的内容就是student;RadioGroup1.Items[2]的内容就是score;
现在我要在运行的时候,比如我选了class,[**]处值为0,选student[**]处值为1,;想问一下[**]处的这个函数要怎么写。
(不善表达,请见谅)
#4
shuang2009112010-04-30 16:13

RadioGroup1.ItemIndex  得到选中的顺序号,第一项为0,第二项为1,  ......
RadioGroup1.Items[RadioGroup1.ItemIndex]  可以得到选中的项标题
1