🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.winforms.controls.using
1 messages
1 total messages Started by Saravanan Wed, 11 Oct 2006 12:12
Using WinForm controls in VCL .NET applications
#32
Author: Saravanan
Date: Wed, 11 Oct 2006 12:12
92 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads