NullReferenceException on 12th item in combo box, Vista and Windows7

J Trahair

Well-known member
Joined
May 14, 2008
Messages
175
Location
Spain
Programming Experience
10+
Hi. I have a project which has an invoicing form, with a combo box populated with customers codes. You *either* click on the combo box down-arrow then click on the required customer code eg. BAC103 *or* type BAC then press the keyboard down arrow to locate and display the customer's details. This works every time, regardless, on my Windows XP development machine.

On my Windows 7 machine, if I type BAC and press the keyboard down arrow, it succeeds every time, as it does also on my customer's Vista machine.

However, on the Windows Vista and 7 machines, if I use the mouse to click on BAC103 (which happens to be the 12th item in the list), it throws up a NullReferenceException box which does NOT attach itself to the offending line whilst in development mode. Therefore I can't identify the offending line (and I spent part of the weekend trying to do this).

The NullReferenceException states 'Object reference not set to an instance of an object'.

All the other customer codes work fine, whichever method I use to choose them.

I thought it might be something to do with the customer record for BAC103, so I deleted the customer and re-entered the customer again using BAC103. Same problem. I deleted BAC103 again and clicked on the new 12th item BEM104, which failed just like BAC103 did. But when BAC103 still existed, BEM104 had been working perfectly.

Queries: 1. how can I get the system to attach the NullReferenceException to the offending line? (All normal error trapping is in place, I've tried Try...etc. and the good old On Error Resume Next.) The error doesn't get trapped and therefore crashes the program.
2. What's so special about the 12th item in a combo box?

Any suggestions gratefully received.
 
Back
Top