buttons exception
-
Why is this code throwing exception
gameBoard->gameBtns = gcnew array<Button^>(GameBoard::TOTAL_BOXES);
for each(Button^ btn in gameBoard->gameBtns)
btn->Enabled = true;where TOTAL_BOXES is defined as 9 but this code doesn't
Button^ temp = gcnew Button();
temp->Enabled = true;Top Web Hosting Providers[^] Do, or do not. There is no 'try'.
-
Why is this code throwing exception
gameBoard->gameBtns = gcnew array<Button^>(GameBoard::TOTAL_BOXES);
for each(Button^ btn in gameBoard->gameBtns)
btn->Enabled = true;where TOTAL_BOXES is defined as 9 but this code doesn't
Button^ temp = gcnew Button();
temp->Enabled = true;Top Web Hosting Providers[^] Do, or do not. There is no 'try'.
Hi,
Ahmed Manzoor wrote:
Button^ temp = gcnew Button();
creates a button, so you can operate on it.
Ahmed Manzoor wrote:
gameBtns = gcnew array<button^>(GameBoard::TOTAL_BOXES);
Does not generate any buttons, all it does is generate an array that will be able to hold some buttons. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
Hi,
Ahmed Manzoor wrote:
Button^ temp = gcnew Button();
creates a button, so you can operate on it.
Ahmed Manzoor wrote:
gameBtns = gcnew array<button^>(GameBoard::TOTAL_BOXES);
Does not generate any buttons, all it does is generate an array that will be able to hold some buttons. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
so I'll have to generate each button individually?
Top Web Hosting Providers[^] Do, or do not. There is no 'try'.
Ahmed Manzoor wrote:
so I'll have to generate each button individually?
Yes. You did it when you needed one, what makes you think you don't have to when you want a lot of them? BTW: array elements are initialized to null; you only need to create as many buttons as you need, you can leave the non-essential elements, if any, at null. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets