Object reference not set to an instance of an object.

  • Thread starter Thread starter Jacky
  • Start date Start date
J

Jacky

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
 
You'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

: 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
:
:
:
 
Back
Top