Click here to Skip to main content
       

C / C++ / MFC

 
GeneralRe: Testing my first C driver PinmemberJochen Arndt2-Apr-13 3:05 
GeneralRe: Testing my first C driver PinmemberErudite_Eric3-Apr-13 3:34 
QuestionRe: Testing my first C driver PinmemberDavidCrow2-Apr-13 4:34 
AnswerRe: Testing my first C driver PinmemberErudite_Eric3-Apr-13 0:45 
AnswerRe: Testing my first C driver PinmemberErudite_Eric3-Apr-13 0:58 
Questioncode conversion MATLAB to c PinmemberMember 99587781-Apr-13 21:12 
AnswerRe: code conversion MATLAB to c PinmemberChris Losinger2-Apr-13 7:49 
QuestionAccessing Win32 APIs from WinRT app through Win32 Dll Pinmembermsr_codeproject1-Apr-13 4:21 
AnswerRe: Accessing Win32 APIs from WinRT app through Win32 Dll PinmvpRichard MacCutchan1-Apr-13 21:37 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pinmembermsr_codeproject1-Apr-13 23:17 
AnswerRe: Accessing Win32 APIs from WinRT app through Win32 Dll PinmemberMicroVirus1-Apr-13 23:43 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pinmembermsr_codeproject2-Apr-13 1:03 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll PinmemberMicroVirus3-Apr-13 10:41 
QuestionCreating an array of global Labels at runtime [modified] PinmemberDouglas Kirk31-Mar-13 12:08 
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++]->
 
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 PinmvpRichard MacCutchan31-Mar-13 13:54 
GeneralRe: Creating an array of global Labels at runtime PinmemberDouglas Kirk31-Mar-13 14:08 
GeneralRe: Creating an array of global Labels at runtime PinmemberThePhantomUpvoter31-Mar-13 14:12 
GeneralRe: Creating an array of global Labels at runtime PinmemberDouglas Kirk31-Mar-13 14:28 
GeneralRe: Creating an array of global Labels at runtime PinmemberThePhantomUpvoter31-Mar-13 15:16 
QuestionWhere to post/share example? PinmemberReturnVoid30-Mar-13 1:45 
AnswerRe: Where to post/share example? PinmemberThePhantomUpvoter30-Mar-13 2:29 
AnswerRe: Where to post/share example? PinmemberPravinda Amarathunge30-Mar-13 3:27 
QuestionHow to control the other app using Window API PinmemberMember 916988729-Mar-13 4:16 
AnswerRe: How to control the other app using Window API Pinmemberdusty_dex29-Mar-13 4:27 
GeneralRe: How to control the other app using Window API PinmemberMember 916988729-Mar-13 5:38 
AnswerRe: How to control the other app using Window API PinmvpRichard MacCutchan29-Mar-13 5:59 
AnswerRe: How to control the other app using Window API PinmemberErudite_Eric31-Mar-13 5:04 
QuestionIs someone willing? PinmemberTyler Candee29-Mar-13 2:36 
AnswerRe: Is someone willing? PinmvpRichard MacCutchan29-Mar-13 3:39 
GeneralRe: Is someone willing? PinmemberTyler Candee29-Mar-13 8:13 
QuestionShell Link Properties [SOLVED] PinmemberRichard Andrew x6428-Mar-13 15:48 
QuestionAddSourceFilter - passing file path paramater PinmemberVaclav_Sal28-Mar-13 11:47 
AnswerRe: AddSourceFilter - passing file path paramater PinmvpRichard MacCutchan28-Mar-13 22:41 
RantISamplerGrabber future ?? PinmemberVaclav_Sal26-Mar-13 8:01 
GeneralRe: ISamplerGrabber future ?? PinmvpRichard MacCutchan26-Mar-13 9:17 
GeneralRe: ISamplerGrabber future ?? PinmemberChris Losinger27-Mar-13 5:03 
GeneralRe: ISamplerGrabber future ?? PinmvpRichard MacCutchan27-Mar-13 5:15 
GeneralRe: ISamplerGrabber future ?? PinmemberJoe Woodbury26-Mar-13 9:26 
GeneralRe: ISamplerGrabber future ?? PinmemberSoMad26-Mar-13 11:57 
GeneralRe: ISamplerGrabber future ?? PinmemberVaclav_Sal28-Mar-13 12:14 
GeneralRe: ISamplerGrabber future ?? PinmemberSoMad28-Mar-13 20:34 
QuestionTurbo code implementation in C++ PinmemberManoj739025-Mar-13 20:50 
AnswerRe: Turbo code implementation in C++ PinmemberJochen Arndt25-Mar-13 22:09 
GeneralRe: Turbo code implementation in C++ Pinmembervikrams25-Mar-13 22:39 
GeneralRe: Turbo code implementation in C++ Pinmembervikrams25-Mar-13 23:17 
QuestionHow can i create a project that it has the same name with an existing project PinmemberNovember 201325-Mar-13 5:33 
QuestionRe: How can i create a project that it has the same name with an existing project [modified] PinmemberDavidCrow25-Mar-13 6:17 
AnswerRe: How can i create a project that it has the same name with an existing project PinmemberNovember 201326-Mar-13 2:56 
AnswerRe: How can i create a project that it has the same name with an existing project PinmvpRichard MacCutchan25-Mar-13 7:32 
GeneralRe: How can i create a project that it has the same name with an existing project PinmemberNovember 201326-Mar-13 4:03 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 11 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid