<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Yes, this is Delphi 'internal feature' ;)<br>You can use everything except -1.<br><br>Edward Koryagin<br><br>--- On <b>Tue, 16/2/10, sinu sudhakaran <i>&lt;sinusudhakaran@rediffmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: sinu sudhakaran &lt;sinusudhakaran@rediffmail.com&gt;<br>Subject: [DUG]  Is it a bug in latest versions of Delphi?<br>To: delphi@delphi.org.nz<br>Cc: John.Hansen@wizbang.co.nz, Delio.Azevedo@wizbang.co.nz, Richard.Crowle@wizbang.co.nz, James.Stainton@wizbang.co.nz<br>Received: Tuesday, 16 February, 2010, 9:25 AM<br><br><div id="yiv1434376983">Hi all,<br>
<br>
I came across a strange bug(???) in latest versions of Delphi.<br>
<br>
Have a look at the following code.<br>
<br>
procedure TForm1.Button1Click(Sender: TObject);<br>
var<br>
i : integer;<br>
begin<br>
ComboBox1.Clear;<br>
ComboBox1.Items.AddObject('All Locations', TObject(-1));<br>
ComboBox1.Items.AddObject('Only this Location', TObject(0));<br>
ComboBox1.Items.AddObject(Test Location', TObject(1));<br>
<br>
i := Integer(ComboBox1.Items.Objects[0]);<br>
showmessage(inttostr(i));<br>
end;<br>
<br>
When I tried to run this code in Delphi 6 and Delphi 2007 , I am getting List Index out of bounds[0] error in Showmessage. When I tried -2, -3, -4… instead of -1 object , I got the proper output without any <br>
List index out of bounds error. Also I am getting -1 without any error when I tried this code in Delphi 3. <br>
<br>
Is it a bug in latest version of Delphi ? Any help is appreciated.<br>
<br>
Thank you<br>
<br>
Regards,<br>
Sinu<br>
<br><table style="font-family: Verdana; font-size: 11px; line-height: 15px;" width="644" border="0" cellpadding="0" cellspacing="0" height="57"><tbody><tr><td><a rel="nofollow" target="_blank" href="http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline.htm@Middle?"><img src="http://sigads.rediff.com/RealMedia/ads/adstream_nx.ads/www.rediffmail.com/signatureline.htm@Middle"></a></td></tr></tbody></table></div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a ymailto="mailto:delphi@delphi.org.nz" href="/mc/compose?to=delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a ymailto="mailto:delphi-request@delphi.org.nz"
 href="/mc/compose?to=delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe</div></blockquote></td></tr></table><br>



      Email slow, clunky, unreliable? <a href=http://au.rd.yahoo.com/nz/mail/tagline/2009/mailsignup/*http://yahoo.co.nz/mail>Switch to Yahoo!Xtra Mail</a>, New Zealand&#39;s new email address.