Click here to Skip to main content
16,020,261 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I built a UserControl (TagSelect) on the assumption that I could use it multiple times on the same window.
My assumption was based on the idea that each new use of the UC would instantiate a new TagSelect object of the class. Is this a correct assumption? It looks like this is not correct.
Before going into further detail at this point, can anyone point me to a reference for issues or approaches to reusing a UC multiple times in a window.
This particular one is to be used in a DataGridRow Column. So it will be used many times.

What I have tried:

I have read everything I can find and no clear answer.
Posted
Updated 6-Aug-22 11:21am

Unless you write the control specifically for the purpose, yes, every time you use the control it's a new instance.

Beyond that, you're going to have to give a lot more detail about what you're doing, what the problem is, and the code you've used.
 
Share this answer
 
Comments
hardover 5-Aug-22 16:37pm    
Thank you for your response. I realize more detail is required. I will soon post a simplified example of what I am seeing. I would appreciate our input at that time.
hardover 5-Aug-22 18:13pm    
Dave K, what is the best way to get a description and the code so you can see it? I have a .RAR file with the VS solution and in is a doc the describes intent and results. I don't see a way to attach a file to the question.
Dave Kreskowiak 6-Aug-22 12:47pm    
You hover over your question and click "Improve question", then post the relevant code in PRE tags. There is no facility to upload any files, and, frankly, I wouldn't trust any such files enough to download them.
OK. I have solved this issue and everything does work as I assumed.

The issue here was that old standard - Doh

I carefully created a new list for each instance of the UC, but loaded it with old objects instead of new ones.

Should have found it a lot sooner

Thank you for the time you wasted and the willingness to help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900