delphi dbgrid 中删除一列
procedureTForm2.click1(Sender:TObject);varDBGridColumn:TColumn;columnindex:integer;be...
procedure TForm2.click1(Sender: TObject);var
DBGridColumn: TColumn;
columnindex : integer;
begin
if form2.CheckBox1.Checked then
begin
DBGridColumn := DBGrid2.Columns.Add;
DBGridColumn.Title.Caption := 'CODE_1';
DBGridColumn.FieldName := ('CODE_1');
dbgridcolumn.Width :=60;
end; if form2.CheckBox1.Checked = false then
dbgrid2.Columns.Delete();
//这里我想删除我上面创建的那列,但是delete中index我不知道,这个怎么写
end; 展开
DBGridColumn: TColumn;
columnindex : integer;
begin
if form2.CheckBox1.Checked then
begin
DBGridColumn := DBGrid2.Columns.Add;
DBGridColumn.Title.Caption := 'CODE_1';
DBGridColumn.FieldName := ('CODE_1');
dbgridcolumn.Width :=60;
end; if form2.CheckBox1.Checked = false then
dbgrid2.Columns.Delete();
//这里我想删除我上面创建的那列,但是delete中index我不知道,这个怎么写
end; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询