<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:Verdana;}
h1
        {margin-top:12.0pt;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        text-align:center;
        font-size:16.0pt;
        font-family:Verdana;}
h2
        {margin-top:12.0pt;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        font-size:14.0pt;
        font-family:Verdana;
        font-style:italic;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:2121144827;
        mso-list-type:hybrid;
        mso-list-template-ids:-2017818678 1659512970 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:Arial;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>This is only D2005 compatible...</span></font><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><font
size=2 color=navy face=Wingdings><span style='font-size:10.0pt;font-family:
Wingdings;color:navy'><span style='mso-list:Ignore'>&Oslash;<font size=1
face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font color=navy face=Arial><span
style='font-family:Arial;color:navy'>er, D6<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>But I have found a great article on
importing xls data direct into the grid, which does me =)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanx anyway<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font face=Tahoma><span
style='font-family:Tahoma'> delphi-bounces@ns3.123.co.nz
[mailto:delphi-bounces@ns3.123.co.nz] <b><span style='font-weight:bold'>On
Behalf Of </span></b>JeremyN@frontiersoftware.com.au<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, 11 February 2005
5:38 p.m.<br>
<b><span style='font-weight:bold'>To:</span></b> delphi@ns3.123.co.nz<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [DUG] Dynamically
fill DBGrid from TStringlist</span></font><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>Insert the rows into the dataset that is
connected to the grid.</span></font><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>This is only D2005 compatible...</span></font><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>=======&nbsp; unit ==============</span></font><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>unit Unit55;</span></font><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>interface</span></font><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>uses<br>
&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,<br>
&nbsp; Dialogs, DB, Grids, DBGrids, DBClient, StdCtrls;</span></font><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>type<br>
&nbsp; TForm55 = class(TForm)<br>
&nbsp;&nbsp;&nbsp; DataSource1: TDataSource;<br>
&nbsp;&nbsp;&nbsp; ClientDataSet1: TClientDataSet;<br>
&nbsp;&nbsp;&nbsp; DBGrid1: TDBGrid;<br>
&nbsp;&nbsp;&nbsp; Button1: TButton;<br>
&nbsp;&nbsp;&nbsp; Button2: TButton;<br>
&nbsp;&nbsp;&nbsp; procedure Button2Click(Sender: TObject);<br>
&nbsp;&nbsp;&nbsp; procedure Button1Click(Sender: TObject);<br>
&nbsp; private<br>
&nbsp;&nbsp;&nbsp; { Private declarations }<br>
&nbsp; public<br>
&nbsp;&nbsp;&nbsp; { Public declarations }<br>
&nbsp; end;</span></font><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>var<br>
&nbsp; Form55: TForm55;</span></font><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>implementation</span></font><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>{$R *.dfm}</span></font><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>procedure TForm55.Button1Click(Sender:
TObject);<br>
var<br>
&nbsp; lList: TStringList;<br>
&nbsp; lStr: String;<br>
&nbsp; lCnt: Integer;<br>
begin<br>
&nbsp; lList := TStringList.Create;<br>
&nbsp; try<br>
&nbsp;&nbsp;&nbsp; lList.Add('Item0');<br>
&nbsp;&nbsp;&nbsp; lList.Add('Item1');<br>
&nbsp;&nbsp;&nbsp; lList.Add('Item2');<br>
&nbsp;&nbsp;&nbsp; lList.Add('Item3');<br>
&nbsp;&nbsp;&nbsp; lList.Add('Item4');<br>
&nbsp;&nbsp;&nbsp; lList.Add('Item5');<br>
&nbsp;&nbsp;&nbsp; ClientDataSet1.FieldDefs.Add('FieldOne', ftInteger, 0,
False);<br>
&nbsp;&nbsp;&nbsp; ClientDataSet1.FieldDefs.Add('FieldTwo', ftString, 10,
False);<br>
&nbsp;&nbsp;&nbsp; ClientDataSet1.CreateDataSet;<br>
&nbsp;&nbsp;&nbsp; ClientDataSet1.Active := True;<br>
&nbsp;&nbsp;&nbsp; lCnt := 0;<br>
&nbsp;&nbsp;&nbsp; for lStr in lList do<br>
&nbsp;&nbsp;&nbsp; begin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientDataSet1.Append;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientDataSet1.Fields[0].AsInteger := lCnt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientDataSet1.Fields[1].AsString := lStr;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientDataSet1.Post;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inc(lCnt);<br>
&nbsp;&nbsp;&nbsp; end;<br>
&nbsp; finally<br>
&nbsp;&nbsp;&nbsp; FreeAndNil(lList);<br>
&nbsp; end;<br>
end;</span></font><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>procedure TForm55.Button2Click(Sender:
TObject);<br>
begin<br>
&nbsp; ClientDataSet1.Active := False;<br>
&nbsp; close;<br>
end;</span></font><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>end.</span></font><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>====== form ==============</span></font><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>object Form55: TForm55<br>
&nbsp; Left = 0<br>
&nbsp; Top = 0<br>
&nbsp; Width = 391<br>
&nbsp; Height = 270<br>
&nbsp; Caption = 'Form55'<br>
&nbsp; Color = clBtnFace<br>
&nbsp; Font.Charset = DEFAULT_CHARSET<br>
&nbsp; Font.Color = clWindowText<br>
&nbsp; Font.Height = -11<br>
&nbsp; Font.Name = 'Tahoma'<br>
&nbsp; Font.Style = []<br>
&nbsp; OldCreateOrder = False<br>
&nbsp; PixelsPerInch = 96<br>
&nbsp; TextHeight = 13<br>
&nbsp; object DBGrid1: TDBGrid<br>
&nbsp;&nbsp;&nbsp; Left = 8<br>
&nbsp;&nbsp;&nbsp; Top = 40<br>
&nbsp;&nbsp;&nbsp; Width = 369<br>
&nbsp;&nbsp;&nbsp; Height = 193<br>
&nbsp;&nbsp;&nbsp; DataSource = DataSource1<br>
&nbsp;&nbsp;&nbsp; TabOrder = 0<br>
&nbsp;&nbsp;&nbsp; TitleFont.Charset = DEFAULT_CHARSET<br>
&nbsp;&nbsp;&nbsp; TitleFont.Color = clWindowText<br>
&nbsp;&nbsp;&nbsp; TitleFont.Height = -11<br>
&nbsp;&nbsp;&nbsp; TitleFont.Name = 'Tahoma'<br>
&nbsp;&nbsp;&nbsp; TitleFont.Style = []<br>
&nbsp; end<br>
&nbsp; object Button1: TButton<br>
&nbsp;&nbsp;&nbsp; Left = 8<br>
&nbsp;&nbsp;&nbsp; Top = 8<br>
&nbsp;&nbsp;&nbsp; Width = 75<br>
&nbsp;&nbsp;&nbsp; Height = 25<br>
&nbsp;&nbsp;&nbsp; Caption = 'Execute'<br>
&nbsp;&nbsp;&nbsp; TabOrder = 1<br>
&nbsp;&nbsp;&nbsp; OnClick = Button1Click<br>
&nbsp; end<br>
&nbsp; object Button2: TButton<br>
&nbsp;&nbsp;&nbsp; Left = 304<br>
&nbsp;&nbsp;&nbsp; Top = 8<br>
&nbsp;&nbsp;&nbsp; Width = 75<br>
&nbsp;&nbsp;&nbsp; Height = 25<br>
&nbsp;&nbsp;&nbsp; Caption = 'Close'<br>
&nbsp;&nbsp;&nbsp; TabOrder = 2<br>
&nbsp;&nbsp;&nbsp; OnClick = Button2Click<br>
&nbsp; end<br>
&nbsp; object DataSource1: TDataSource<br>
&nbsp;&nbsp;&nbsp; DataSet = ClientDataSet1<br>
&nbsp;&nbsp;&nbsp; Left = 184<br>
&nbsp;&nbsp;&nbsp; Top = 120<br>
&nbsp; end<br>
&nbsp; object ClientDataSet1: TClientDataSet<br>
&nbsp;&nbsp;&nbsp; Aggregates = &lt;&gt;<br>
&nbsp;&nbsp;&nbsp; Params = &lt;&gt;<br>
&nbsp;&nbsp;&nbsp; Left = 192<br>
&nbsp;&nbsp;&nbsp; Top = 128<br>
&nbsp; end<br>
end</span></font><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>cheers,</span></font><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>JED<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt;font-family:"Times New Roman"'>&nbsp;<o:p></o:p></span></font></p>

</div>

<blockquote style='margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> tracey
[mailto:tracey@logis.co.nz]<br>
<b><span style='font-weight:bold'>Sent:</span></b> 10 February 2005 8:56 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">NZ
 Borland Developers Group - <st1:place w:st="on">Delphi</st1:place> List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> [DUG] Dynamically fill
DBGrid from TStringlist</span></font><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Is this possible?&nbsp; How does one dynamically load rows
into a DBGrid from code?<o:p></o:p></span></font></p>

</blockquote>

</div>

</body>

</html>