Greetings,
I've come across a weird issue and I haven't been able to figure out what is occurring. I have added an OptionSet to a child form and have it bound to a system.windows.form.bindingsource. During the form load event, I set up a value list and add two items to it.
During testing when the form is opened the first time, it displays as expected... However, when the form is closed and re-opened all the controls except for the OptionSet display. I tried stepping through the code to see if I could catch any error that might not be popping, but nothing. Stepping through the code, the value list is built and added to the optionset so it appears the control exists but it just doesn't display. I have a couple of other Infragistic controls on the form and they display fine. I'm using VB.Net for the language.
Am I missing something during form shutdown to clean up the optionset or is it something else I have to do in order to have the control display each time the form is opened?
Thanks
Well I found tomoe to figure out this issue and it was do to programmer error. During form load I was setting the Verticla spacing +=35. What was happening is everytime the form would open it woul increase this by 35 thus moving it out of site. Resetting this to 0 each time before setting it fixed the issue..
I'm as puzzled as you are. Except for the toolbar every control on the form is an Infrgaistics control. Except for the OptionSet all the rest display just fine when I re-open the form.
So you were displaying the static instance of the form instead of an instance version. I'm not certain, but I don't know if calling close on a static instance of a form really closes it.... But otherwise I don't see why that would have caused problems. I'll have to try that out.
Well I found a work around to the issue. In the original code, the main form was doing a direct call to the child form that had the optionset control. On a hunch, I changed the code and instantiated a copy of the form and called this instead. Upon return from the child form, I set the form variable to nothing.
Doing this fixed the problem as each time I need to open the form, it is a new instantiation of it (it's never really re-opened).
So the original code that had the problem
With frmUserRoles .UserKey = _UserKey .UserId = _UserID .Close ....End With
New code that works each time the form is opened:
Dim frm as New frmUserRolesWith frm .UserKey = _UserKey .UserID = _UserID .Close ....End With
frm = Nothing
So it appears that something is hanging somewhere even after the form is closed if called directly which causes the OptionSet not to be displayed if the form is re-opened. Hopefully, this gives someone an idea of what might be happening so it can be addressed. In the meantime, I'll just use my workaround for this problem in case I see it again.
Can you post a sample app to test?