View Single Post
  #2 (permalink)  
Old June 28th, 2012, 01:19 PM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Quote:
Could the problem be in the designer code or somewhere else?
That's good intuition. If you're pretty sure the code is correct, then there is sometimes a property on the form set by the Form Designer that changes the way things work.

Here, however, I don't think there are any properties that would change this.

I suspect the problem is in the code that displays the form. If you look at the pick button event handlers on the main form, one of the things they do before displaying the session form is setting the session form's SessionIndex property with code like this:

Code:
frm.SessionIndex = SessionIndex1;
Then the session form's Load event handler uses the form's SessionIndex to initialize the selected item. If the main form's event handler doesn't set SessionIndex, then it would default to 0 and the session form would always initially select the first item (with index 0).

Let me know if that works.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)