Setting Enabled on unrendered tab

0
0

Hi,

I’m sure I’ve spotted the solution for this, I saw something mentioned in a code snippet somewhere that I suspect is the fix … but can’t recall what/where!

I have a UserControl placed on a TabPage in the parent form.  It is on the second tab and therefore not displayed when the form loads.

The parent form has a student selection list.  Prior to student selection I don’t want any interaction on the UserControl, so this.Enabled = false at design time, and then “public void LoadFees(ApplicationService service, CourseEnrolment enrolment) => [SNIPPED] this.Enabled = true;” is called when a student is selected.

If the tab is selected (so the UserControl is visible) prior to selecting a student, all works as expected, however if the student is selected then the tab is selected, the UserControl is still disabled.

Can you advise?

Cheers,
Neil

  • You must to post comments
0
0

Can’t reproduce. I added a TabControl with 2 pages, added a UserControl on each page with a child button and Enabled = false at design time. It shows the buttons as disabled since the parent UserControl is disabled. Then I have a button that sets Enabled=true on both UserControl in both tabs. In any possible sequence settings Enabled=true works.

Can you attach a small test case?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.