Doug Thews
4/9/2002 6:53:00 AM
I've got a 3-form page in my MMIT application. The first form allows the
user to enter filter criteria and has a 'Search' button. The 2nd form
displays all of the results in an Object list, and has a Command event to do
an event on a specific item in the list. And the 3rd form displays the
results of doing the event on the item in the list and has a button to go
back to the first form and start again.
All appears to work fine, except when I go through the process the second
time. I get an invalided SelectedItemIndex = -1 error when going to the
second form. This is obviously in reference to the selected index of the
ObjectList on Form 2. I can workaround the error by manually setting the
selected index of the object list to 0 manually in the Activate method of
Form 2 (which I don't think I should have to do - especially since this all
worked the first pass through).
Here's a synopsis of the code/form progression:
Form #1
OnButtonClick:
Retrieve values from DB based upon textbox filter
Populate dataset and bind dataset to ObjectList on Form #2 (w/DataBind)
Set Active Form = Form #2
Form #2
OnItemSelectCommand:
Retrieve item selected
Perform action in DB against item selected
Set success/fail status to Label on Form #3
Set Active Form = Form #3
Form #3 (use to review results only - no processing)
OnButtonClick:
Set Active Form = Form #1
For the workaround, I created a handler for the Activate event of Form #2
and manually set the SelectedIndex property to 0. Question is, why is this
necessary since I went through and rebound the Object List with a new
dataset in Form #1 again the 2nd time through?
Thoughts?
--
Doug Thews
Director, Software Development
D&D Consulting Services