Link to home
Start Free TrialLog in
Avatar of CyprexxDev
CyprexxDevFlag for United States of America

asked on

Listbox value property will not reset to null

What I'm doing is slightly complicated, but I'll explain as best I can.  I have a listbox that's populating with a recordset based on the selection of an option frame.  If a user clicks on the first item in the option frame, the list box may populate with 3 records.  We'll say these records have Values 1, 2, and 3.  If the user then selects the first record (with value 1), a text box populates with the information for that record.  The problem comes in if the user changes the Option frame selection.  If he then picks a different option, the list box may populate with a null recordset which is fine.  If I run a listcount against the lsitbox, it comes back with 0 which is correct.  The problem is, the Value property of the listbox is still set to 1 (or whatever the LAST value was).  It will not resort back to an empty or null value.  Is there any way to force this property back?  Thanks!
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CyprexxDev

ASKER

Capricorn,
I've tried that.  The problem is, if you ser the selected propery to false for every item in the lsitbox, it will not allow you to select anything after that point.  What happens is I can click on a row after that runs, but the selection will flash on and off and the OnClick event for the ListBox control will not run at all.

LSMConsulting,
I tried your solution and it worked.   I had actually thought about this, but for some reason I kept thinking the Value property was read-only, so I never even tried it.  I guess I should have tried anyway.  And yes, I'm running code in a stored procedure that pulls the value of the list box at many different points in time.  I want to make sure this value is null if nothing is selected so the SP does not return anything otherwise my textbox populates with data from the last selected value.

I'm going to assign 75 points to Capricorn since this solution SHOULD work in my opinion and it was a good idea regardless.  LSM's was easier - I was just dumb...  but it's what actually fixed my problem.
<The problem is, if you ser the selected propery to false for every item in the lsitbox, it will not allow you to select anything after that point>

you will place the clodes in the click event or after update of the option frame as
i mentioned in my post NOT in the CLICK event of the list box