C
C#2y ago
Dawnbomb

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

After struggling for awhile to find out why Grid.Parent.Controls.Remove wasn't accepting parent. (i never learned how, i just changed to targeting the parent directly with Parent.Children.Remove) i am now struggling to find out how to delete from memory as 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 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); and i still get a error. Considering Grid.Children.Remove is working, this is rather strange to me.
6 Replies
Anton
Anton2y ago
you can't remove it from memory. it's gonna stick around until gc happens
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Dawnbomb
DawnbombOP2y ago
as in i don't need to do anything, it will automtaically be taken by the garbage collector?
Anton
Anton2y ago
yes
Dawnbomb
DawnbombOP2y ago
Thanks!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server