Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF VB.NET
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
        MainGrid.IsEnabled=False
        ReportGrid.Children.Add(Frm)
 
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.
Posted 25-Apr-13 22:01pm
Comments
Maciej Los at 26-Apr-13 3:24am
   
I'm not similar with WPF as good as i wish, but see this: XAML Overview (WPF)[^].
 
ReportGrid.Children.Remove(Frm)
 
More: Introduction to WPF[^]
How to remove control from parent?[^]
Vamshi Krishna Naidu at 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 at 26-Apr-13 3:39am
   
Did you try this: ReportGrid.Children(0) = Nothing?
Vamshi Krishna Naidu at 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)

  Print Answers RSS
0 OriginalGriff 250
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 DamithSL 125
4 Afzaal Ahmad Zeeshan 120
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 26 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100