0

I want to create and then destroy buttons, all with code, but can't find anything that adequately explains the process.

Button btnQA1 = new Button();
greg.Children.Add(btnQA1);
btnQA1.Content = QA;
Grid.SetColumn(btnQA1, CRNOne);

How do I put that code above into a using statement? greg is the name of the grid I'm using.

2
  • 1
    You cannot destroy the button while the Grid is using it. It's the responsibility of the grid to dispose of its children, just like any other containers. Commented Mar 24, 2012 at 3:24
  • That worked. Wanna put your comment as an answer? Commented Mar 24, 2012 at 3:34

1 Answer 1

1

You cannot destroy the button while the Grid is using it. It's the responsibility of the grid to dispose of its children, just like any other containers

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.