这个RadioButton怎么用?(50分)

  • 主题发起人 小女人
  • 开始时间

小女人

Unregistered / Unconfirmed
GUEST, unregistred user!
我在一查询中加了10个RadioButton,
当点击查询按钮时我怎么才知道哪一个RadioButton被选中?
 
如果是有10个radioButton,那你应该用RadioGroup控件,这样判断就容易多了。
 
在RadioButton.tag中赋值1..10;
所有RadioButton响应同一个Click消息,记下tag值,
你就知道是哪个RadioButton被选中了
 
for i := 0 to self.componentcount do
if self.components is TradioButton do
if (self.components as TradioButton).check then
.........
 
我才学delphi一个月,能不能写一下代码?谢谢各位:)
 
在onclick事件中用 sender.name
 
就青铜三代的我可以看懂,可是这样做是不是太繁琐了
 
分别设置radiobutton的tag为0...9,然后在其中一个
radiobutton的onclick事件中写入:
case (sender as Tradiobutton).tag of
0:所对应的sql语句~!
1:所对应的sql语句~!
...
9:所对应的sql语句~!
end;
adoquery1.sql.clear;
adoquery1.sql.add(sql语句!);
adoquery1.open;
其它的radiobutton的onclick事件中调用这个onclick 事件即可!
 
真搞不懂,这么多人为什么不推荐用RadioGroup控件呢?奇怪
对于小女子这种情况,用RadioGroup是最省事最方便的,判断代码仅仅是一句。
 
要不是提问者是一个MM,我看大家都懒得回答这样弱智的问题!
 
楼上的小女人怎么了!对于我来说这不是个弱智的问题!谁不是从初学走过来的,
我一定会写出好软件的!
 
“小女人”是写不出好软件的,哈哈
 
用 case 语句判断!
 
for i := 0 to self.componentcount do
if self.components is TradioButton do
if (self.components as TradioButton).check then
begin
adoquery1.sql.clear;
adoquery1.sql.add(sql语句![(self.components as TradioButton).name]);
adoquery1.open;
end;
 
青铜三代,你是青铜公司的吗?
 
顶部