Thursday, March 22, 2012

Object reference not set to an instance of an object.

Hi,

I get the eror "Object reference not set to an instance of
an object" when i paste this line of code "
Me.DDCompCode.Items.FindByValue(e.Item.Cells
(1).Text).Selected = True "
..

Can someone help me out?

Thanks.

JackyYou'd get this error if there is no value in DDCompCode that matches
e.Item.Cells (1).Text

You could try checking to see if

Me.DDCompCode.Items.FindByValue(e.Item.Cells (1).Text) Is Not Nothing

before attempting to set it as the selected value

Cheers
Ken

"Jacky" <jacky@.wisehunter.com.my> wrote in message
news:092601c39e08$500c5ba0$a501280a@.phx.gbl...
: Hi,
:
: I get the eror "Object reference not set to an instance of
: an object" when i paste this line of code "
: Me.DDCompCode.Items.FindByValue(e.Item.Cells
: (1).Text).Selected = True "
: .
:
: Can someone help me out?
:
: Thanks.
:
: Jacky
:
:
:

0 comments:

Post a Comment