Article View: borland.public.delphi.winforms.controls.using
Article #32Using WinForm controls in VCL .NET applications
From: Saravanan
Date: Wed, 11 Oct 2006 12:12
Date: Wed, 11 Oct 2006 12:12
92 lines
2434 bytes
2434 bytes
I used "WinForm Control Import Wizard" to import winform's DataGrid
component and it works fine, I can see the control and place it on a form,
but when I tried to put data in it, it does not work.
Code:
~~~~~
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,System.Data.SqlClient,System.Data, System.ComponentModel,
Borland.Vcl.StdCtrls, Borland.Vcl.NetControlContainer,
Borland.Vcl.NetControl, Borland.Vcl.NetControlWrapper,
Borland.Wrapper.System.Windows.Forms.DataGrid;
type
TForm1 = class(TForm)
Button1: TButton;
DataGrid1: TImpDataGrid;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Connection: SqlConnection;
Adapter: SqlDataAdapter;
CustomerDataSet: DataSet;
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Connection := SqlConnection.Create('Persist Security Info=False;' +
'Integrated Security=SSPI;database=TempCustomer;' +
'server=servername;Connect Timeout=30');
Connection.Open;
CustomerDataSet := DataSet.Create;
Adapter := SqlDataAdapter.Create('select * from tblCustomer', Connection);
Adapter.Fill(CustomerDataSet, 'Customer');
DataGrid1.DataSource := CustomerDataSet;
DataGrid1.DataMember := 'Customer';
end;
end.
This code connects to the Database and get the data but it is not shown in
the DataGrid control (TImpDataGrid).
Thanks & Rgds,
R.Saravanan
--- posted by geoForum on http://delphi.newswhat.com
Technical Details
Message-ID:
<452cd417$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,d90eb18d3643c23c,start X-Google-Attributes: gid1eff29,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Saravanan" <saravanan.ramalingam@ge.com> Subject: Using WinForm controls in VCL .NET applications Newsgroups: borland.public.delphi.winforms.controls.using Date: Wed, 11 Oct 2006 13:12:43 +0100 X-Priority: 3 X-Library: Indy 9.00.12 X-Newsreader: <dedXmlGateway> NNTP-Posting-Host: 213.26.58.195 Message-ID: <452cd417$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1160565783 213.26.58.195 (11 Oct 2006 04:23:03 -0700) Lines: 92 Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail