Click here to Skip to main content
15,665,718 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I tried searching all the websites but i am unable to get this through. If someone can guide me through will be very helpful.

I have 2 grids on form MainForm. 1 MainGrid and 1 ReportGrid. I have a Button Show Report on a form

I use the below code to show my report form in the ReportGrid

Dim Frm As New ReportForm   'This is a user control

This will overlap the Usercontrol on top of my Main form. This works perfectly till here.

On my user control ReportForm, I have a Back button when clicked, it should close the loaded user control and then enable the MainGrid Again.

Now problem is, How to remove the usercontrol from the Reportgrid on Main form? is my question.

I've been searching for solutions over internet for hours with all possible snippets but none worked for me. Any Help would greatly be appreciated.
Maciej Los 26-Apr-13 3:24am    
I'm not similar with WPF as good as i wish, but see this: XAML Overview (WPF)[^].


More: Introduction to WPF[^]
How to remove control from parent?[^]
Vamshi Krishna Naidu 26-Apr-13 3:36am    
I tried both solutions that you provided. None of them worked. Although the concept of VisualTreeHelper Amazed me, it did not do any help in meeting the requirement.
Maciej Los 26-Apr-13 3:39am    
Did you try this: ReportGrid.Children(0) = Nothing?
Vamshi Krishna Naidu 26-Apr-13 9:03am    
Reportgrid is in main form and button is in reportform. Can this be possible?

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