views:

24

answers:

0

My projects involve a number of usercontrols that are actually full blown applications. These usercontrols are designed to be placed onto tab controls. The apps area used by 2 different office locations, so one of the common items found on the controls is a combobox that lists the ID's for each of the 2 offices ('P' and 'G').

I wanted to be able to limit the values in the combobox depending on the situation. For instance, if the usercontrol is going to be accessed by a foremen from either office, then I want to put just the office ID of the office they work for to show, but if an office worker is using it, then I want both office ID's to show in the dropdown.

I tried setting up a officeID property for the usercontrol with the '<System.ComponentModel.Browsable(True)>' set. This property access the item propoerty of the combobox. Then I could set that office's OfficeID list to just the one ID through the property when it is placed on the Tab control. Or I can leave that property value blank if I want to use the default property of the combobox that contains both Office ID's in its items list.

In this case I have 2 tabs, each with a different control setup with the property mentioned in the last paragraph. This scheme worked the first time in. When I clicked the tab for the first app, just the one officeID I set in the property showed in the dropdown. Then I clicked the second tab to show the second app, and again, just the one office ID showed in the dropdown.

But then, when I return to the first tab, the default values of both ID's showed up. Same for the second control when I returned to it.

I can not figure why the default property is showing up after selecting the controls the second time.

Any help is appreciated.

Thanks.

Marshall