🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database.dotnet
Article #14

Re: "Index 1 is not non-negative and below total rows count"

#14
From: Brigitte Spatz
Date: Fri, 12 Jan 2007 07:51
31 lines
2186 bytes
Brigitte Spatz wrote:
> Marc Rohloff [TeamB] wrote:
>> On Wed, 10 Jan 2007 14:49:23 +0100, Brigitte Spatz wrote:
>>
>>>      bm.AddNew; //bm = BindingManager
>>>      with dv.Item[bm.Position].Row do
>>>
>>> Inspecting shows bm.Position to be correct. What could be wrong here?
>>
>> What are the values of bm.Position and dv.Count?
> 
> Immediately after bm.AddNew bm.Position is 1 and so is dv.count, but 
> only in that one form, in all others it's 2 (or in general bm.Position + 
> 1).
> 
>>
>> Have you tried calling dv.AddNew instead?
>>
> Yes. I get "Object reference not set to an instance of an object" 
> instead (in the one form, not in the others). 

Disregard this, it was coming from elsewhere.

And while there's a new
> entry in the grid, it doesn't have an ID, which is supposed to come from 
> the database (an identity field) (in all forms).
Furthermore, the row at position bm.position in the grid is being 
overwritten rather than the new record filled, even though I used
with dv.Item[dv.Count - 1].Row do

Brigitte
Technical Details
Message-ID: <45a73dfc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45a4eee5@newsgroups.borland.com> <j17ogn2nca3.dlg@dlg.marcrohloff.com> <45a730e7@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,c2e9cd633050f6c5
X-Google-Attributes: gid1effe6,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 12 Jan 2007 08:51:25 +0100
From: Brigitte Spatz <brigitteNOSPAM.spatz@svenmahn.de>
Organization: Sven Mahn IT-Systementwicklungen
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.database.dotnet
Subject: Re: "Index 1 is not non-negative and below total rows count"
References: <45a4eee5@newsgroups.borland.com> <j17ogn2nca3.dlg@dlg.marcrohloff.com> <45a730e7@newsgroups.borland.com>
In-Reply-To: <45a730e7@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 0702-1, 11/01/2007), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 89.54.115.104
Message-ID: <45a73dfc@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1168588284 89.54.115.104 (11 Jan 2007 23:51:24 -0800)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail