procedure TForm1.FormCreate(Sender: TObject);
var
Check1: TCheckBox;
Check2: TCheckBox;
Check3: TCheckBox;
Check4: TCheckBox; begin
check1.tag=0;
check2.tag=1;
check3.tag=2;
check4.tag=3;
if Not (Sender is TCheckBox) then Exit;//²»ÕýÈ·µÄʼþ¾Í²»×ö´¦Àí
Check1 := Sender as TCheckBox;
Check2 := Sender as TCheckBox;
Check3 := Sender as TCheckBox;
Check4 := Sender as TCheckBox;end; procedure TForm1.dadbgrid1onmouseup(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
adotable2.Close;
adotable2.Filter:=' kh='''+form1.DBGrid1.Fields[0].AsString+'''' ;
adotable2.Filtered:=true;
adotable2.Open; while not adotable2.Eof do
begin
if inttostr((Sender as TCheckBox).Tag)=(form1.adotable2.fieldbyname('bkdm').asstring) then (sender as TCheckBox).Checked:=true
else
(sender as TCheckBox).Checked:=false; end;
// form1.ADOTable2.Next;
end;这一句if inttostr((Sender as TCheckBox).Tag)=(form1.adotable2.fieldbyname('bkdm').asstring) then 提示invalid class typecast 错误,
解决方案 »
- 操作Excel之后遇到的问题
- SPComm串口通讯,数据出现遗漏,速手无策ing,求救啊 ~~~~~~
- DataSet调用Cancel方法后为什么还要Post呢?
- 很久没来了,不知各位D友的工资是否涨了些?散分200特此庆祝!!!
- 新年新气象,卖出第一份软件-----29.99欧元!
- 如何去掉RaisError是提示对话框上的[Microsoft][OBDC SQL Server Driver][SQL Server]?
- Who have InstallShield?Send one to me,thank you!
- 能不能用TXMLDocument控件生成一个空XML文档?
- 怎样编sql程序才能与access库文件相连?
- 这样的sql怎么写 case的用法
- bewteen函数使用疑惑
- DELPHI如何制作SQL登陆工具,导入导出小工具
2、在dadbgrid1onmouseup中,筛选不是adotable2.Close,adotable2.Open,而是adotable2.Filterd := False;
adotable2.Filtered := True;
3、在Grid的控件中 Sender as TCheckBox,然后再(Sender as TCheckBox).Checked := True,不知道你是什么意图,这样做转换也是不正确的。
while not adotable2.Eof do
begin
if inttostr((Sender as TCheckBox).Tag)=(form1.adotable2.fieldbyname('bkdm').asstring) then
(sender as TCheckBox).Checked:=true //原因是此处转换失败
else
(sender as TCheckBox).Checked:=false;
end; // form1.ADOTable2.Next; end;
自己循环慢慢找吧
有3个checkbox 如下操作
for i:= 0 to 3 do
check &i .Checked:=true;
check & i 怎么写啊!! 字符串 连接 变量