我在一个数据编辑窗口,点击一个speedbutoon打开一个查询窗口,在编辑窗口又两个dbgrid 每次只有一个时显示的,
speedbutton clicked 事件的代吗时这样的
procedure TDataEdit_Form.SpeedButton14Click(Sender: TObject);
var
Edit_CX_Form:TEdit_CX_Form;
begin
Edit_CX_Form:=TEdit_CX_Form.Create(self);
Edit_CX_Form.Update;
Edit_CX_Form.Showmodal;
end;
------------------------------
然后在新窗体的formshow 有下面的代码;
procedure TEdit_CX_Form.FormShow(Sender: TObject);
var
index:integer;
begin
if dataedit_form.DBGrid_C.Visible=true then //到这里就出现地址访问出错之类的提示,请问这是什么原因?????
//if dataedit_form.ActiveControl.Name='DBGrid_C'then
begin
index:=dataedit_form.DBGrid_C.SelectedIndex;
label2.Caption:=trim(dataedit_form.DBGrid_C.Columns.Item[index].Title.Caption);
fieldname:=dataedit_form.DBGrid_C.Fields[index].FieldName;
end;
if dataedit_form.DBGrid_E.Visible=true then
//if dataedit_form.ActiveControl.Name='DBGrid_E'then
begin
index:=dataedit_form.DBGrid_E.SelectedIndex;
label2.Caption:=trim(dataedit_form.DBGrid_E.Columns.Items[index].Title.Caption);
fieldname:=dataedit_form.DBGrid_E.Fields[index].FieldName;
end;
end;
speedbutton clicked 事件的代吗时这样的
procedure TDataEdit_Form.SpeedButton14Click(Sender: TObject);
var
Edit_CX_Form:TEdit_CX_Form;
begin
Edit_CX_Form:=TEdit_CX_Form.Create(self);
Edit_CX_Form.Update;
Edit_CX_Form.Showmodal;
end;
------------------------------
然后在新窗体的formshow 有下面的代码;
procedure TEdit_CX_Form.FormShow(Sender: TObject);
var
index:integer;
begin
if dataedit_form.DBGrid_C.Visible=true then //到这里就出现地址访问出错之类的提示,请问这是什么原因?????
//if dataedit_form.ActiveControl.Name='DBGrid_C'then
begin
index:=dataedit_form.DBGrid_C.SelectedIndex;
label2.Caption:=trim(dataedit_form.DBGrid_C.Columns.Item[index].Title.Caption);
fieldname:=dataedit_form.DBGrid_C.Fields[index].FieldName;
end;
if dataedit_form.DBGrid_E.Visible=true then
//if dataedit_form.ActiveControl.Name='DBGrid_E'then
begin
index:=dataedit_form.DBGrid_E.SelectedIndex;
label2.Caption:=trim(dataedit_form.DBGrid_E.Columns.Items[index].Title.Caption);
fieldname:=dataedit_form.DBGrid_E.Fields[index].FieldName;
end;
end;
解决方案 »
- SQL查找方法怎么,及其它……求指教
- 福建泉州从事DELPHI开发的朋友,进来报个到啊。。。
- 关于接口, 插件的问题!(如何用Delphi的接口实现插件?)
- 12rain(中雨~百年孤独)来接分~
- 怎样得到动态数组的大小
- 我在做一个通信程序的时候,需要使用DBGrid或Grid控件,将服务器端传来的信息显示
- 怎样在程序中感知SQL2000数据库改动?
- 注册表读取string的问题?
- 请问这个问题.
- 300分急寻:Magic CD Burner,CDWriterXP,NuCDR三个控件刻出来的光盘文件名都是乱码,有谁知道怎样解决,或更好的控件可以做光盘刻录程序?
- DBGrid
- 如何知道image中的图片的格式(jpg,bmp等)
因为dataedit_form.DBGrid_C 还没有被创建,你就进行了引用,逻辑上出现了问题,解决方法:k看看载调用之前?dataedit_form是否运行在内存之中了?设置断点,单步跟踪,(调试法宝:F7,F8)