RecID field

Sims, John ayu8 at cdc.gov
Wed May 4 08:30:00 CDT 2005


> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of 
> Ruslan Zasukhin
> Sent: Wednesday, May 04, 2005 7:33 AM
> To: valentina at lists.macserve.net
> Subject: Re: RecID field
> 
> 
> On 5/4/05 2:06 PM, "Jules Jacquot" <jules.jacquot at wanadoo.fr> wrote:
> 
> >> To pull the RecID for the selected row, you would simply say...
> >> 
> >> iRecID = myListBox.CellTag(myListBox.ListIndex,0)
> > 
> > in fact the error is coming from Listindex ( exception error 
> > nilobjectexception )
> > 
> > that is why i could not retrieve RecID
> > 
> > ruslan, is it a bug ?
> > 
> > do you know a workaround ?
> 
> I am sorry, but I do not see your problem...
> Please try describe all again in details.
> 
> 

Hi Jules,

I would recommend wrapping this code with a check of ListIndex to ensure
that a row is selected...

If myListBox.ListIndex >= 0 then

    iRecID = myListBox.CellTag(myListBox.ListIndex,0)

End if


If myListBox.ListIndex is -1 (which means the listbox does not think a
row is selected) you will received a nilobjectexception when you check
the CellTag property.  By wrapping the the line of code as shown above,
it will protect from this happening.  If this doesn't fix your problem,
try posting the code just before and including the line that is failing
and also the code where you are setting the CellTag value and I'd be
happy to take a quick look at it and see if I can see anything else that
might be causing this problem (as I am sure others on the list would be
happy to do also --- there's some real nice people here :-)

-John



More information about the Valentina mailing list