© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
6 replies
Dawnbomb

❔ ✅ WPF How to delete Textbox from parent and memory.

After struggling for awhile to find out why
Grid.Parent.Controls.Remove
Grid.Parent.Controls.Remove
wasn't accepting parent.
(i never learned how, i just changed to targeting the parent directly with
Parent.Children.Remove
Parent.Children.Remove
)

i am now struggling to find out how to delete from memory as
Grid.Dispose();
Grid.Dispose();
Doesn't work. I get textbox doesn't have a definition for dispose.
How do i delete a textbox from memory in WPF?

And also although i found a workaround, why does
Target.Parent.Controls.Remove
Target.Parent.Controls.Remove
return a error anyway? I assume its because its a winforms command and not WPF, but i've been told it is infact a WPF command. 🤔 (I get no definition for controls). I even tried
Grid.Parent.Children.Remove(Grid);
Grid.Parent.Children.Remove(Grid);
and i still get a error. Considering
Grid.Children.Remove
Grid.Children.Remove
is working, this is rather strange to me.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ WPF textbox
C#CC# / help
3y ago
✅ WPF Masked TextBox
C#CC# / help
3y ago
WPF TextBox Binding
C#CC# / help
4y ago
Cascading delete from child to parent
C#CC# / help
2y ago