Click here to Skip to main content
15,884,986 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: code conversion MATLAB to c Pin
Chris Losinger2-Apr-13 7:49
professionalChris Losinger2-Apr-13 7:49 
QuestionAccessing Win32 APIs from WinRT app through Win32 Dll Pin
msr_codeproject1-Apr-13 4:21
msr_codeproject1-Apr-13 4:21 
AnswerRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
Richard MacCutchan1-Apr-13 21:37
mveRichard MacCutchan1-Apr-13 21:37 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
msr_codeproject1-Apr-13 23:17
msr_codeproject1-Apr-13 23:17 
AnswerRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
MicroVirus1-Apr-13 23:43
MicroVirus1-Apr-13 23:43 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
msr_codeproject2-Apr-13 1:03
msr_codeproject2-Apr-13 1:03 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
MicroVirus3-Apr-13 10:41
MicroVirus3-Apr-13 10:41 
QuestionCreating an array of global Labels at runtime Pin
Douglas Kirk31-Mar-13 12:08
Douglas Kirk31-Mar-13 12:08 
XML
I have an old Borland C++ project that displayed a 16 x 16 group of labels displaying 0x00 to 0xFF for the purpose of diagnostics.

I am now using MicroSoft Visual Studio 2010 C++

I am having a problem creating an array of labels at runtime that the labels are accessable by other routines such as a timer interval routine

<pre lang="c++">
#pragma once
#include <stdio.h>
 
namespace SerialTester {
 
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
 
/// <summary>
/// Summary for Form1
 
int count;
int tindex;
    
 
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
        
    Form1(void)
    {
      InitializeComponent();
      count = 0;
      tindex = 0;
      char buffer[200];

      array< Label ^ > ^ labels;
      labels = gcnew array<Label^>(256);
 
      for (int index = 0; index < 256; ++index) 
      {
         Label ^ label = gcnew Label;

         Controls->Add(label);
         labels[index] = label;
      }
    }
 
    protected:
    /// <summary>




 
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) 
  {
  labels[tindex++]->BackColor = ....... ; }
  }


So when I create the form I created an array of 256 Labels at runtime, labels[x] but in the timer1_Tick I can not access them because the array is not global.

QUESTION: How can I do this, should my creation be somewheres else so that it is global.

Any help from anyone would be greatly appriciated.

Or a link to a tutorial on this.

Thank you in advance
Douglas

modified 31-Mar-13 18:38pm.

GeneralRe: Creating an array of global Labels at runtime Pin
Richard MacCutchan31-Mar-13 13:54
mveRichard MacCutchan31-Mar-13 13:54 
GeneralRe: Creating an array of global Labels at runtime Pin
Douglas Kirk31-Mar-13 14:08
Douglas Kirk31-Mar-13 14:08 
GeneralRe: Creating an array of global Labels at runtime Pin
NotPolitcallyCorrect31-Mar-13 14:12
NotPolitcallyCorrect31-Mar-13 14:12 
GeneralRe: Creating an array of global Labels at runtime Pin
Douglas Kirk31-Mar-13 14:28
Douglas Kirk31-Mar-13 14:28 
GeneralRe: Creating an array of global Labels at runtime Pin
NotPolitcallyCorrect31-Mar-13 15:16
NotPolitcallyCorrect31-Mar-13 15:16 
QuestionWhere to post/share example? Pin
ReturnVoid30-Mar-13 1:45
ReturnVoid30-Mar-13 1:45 
AnswerRe: Where to post/share example? Pin
NotPolitcallyCorrect30-Mar-13 2:29
NotPolitcallyCorrect30-Mar-13 2:29 
AnswerRe: Where to post/share example? Pin
Captain Price30-Mar-13 3:27
professionalCaptain Price30-Mar-13 3:27 
QuestionHow to control the other app using Window API Pin
Member 916988729-Mar-13 4:16
Member 916988729-Mar-13 4:16 
AnswerRe: How to control the other app using Window API Pin
dusty_dex29-Mar-13 4:27
dusty_dex29-Mar-13 4:27 
GeneralRe: How to control the other app using Window API Pin
Member 916988729-Mar-13 5:38
Member 916988729-Mar-13 5:38 
AnswerRe: How to control the other app using Window API Pin
Richard MacCutchan29-Mar-13 5:59
mveRichard MacCutchan29-Mar-13 5:59 
AnswerRe: How to control the other app using Window API Pin
Erudite_Eric31-Mar-13 5:04
Erudite_Eric31-Mar-13 5:04 
QuestionIs someone willing? Pin
Member 982361929-Mar-13 2:36
Member 982361929-Mar-13 2:36 
AnswerRe: Is someone willing? Pin
Richard MacCutchan29-Mar-13 3:39
mveRichard MacCutchan29-Mar-13 3:39 
GeneralRe: Is someone willing? Pin
Member 982361929-Mar-13 8:13
Member 982361929-Mar-13 8:13 
QuestionShell Link Properties [SOLVED] Pin
Richard Andrew x6428-Mar-13 15:48
professionalRichard Andrew x6428-Mar-13 15:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.