Click here to Skip to main content
12,508,992 members (48,213 online)

C / C++ / MFC

 
GeneralRe: Testing my first C driver Pin
Jochen Arndt2-Apr-13 3:05
memberJochen Arndt2-Apr-13 3:05 
GeneralRe: Testing my first C driver Pin
Erudite_Eric3-Apr-13 3:34
memberErudite_Eric3-Apr-13 3:34 
QuestionRe: Testing my first C driver Pin
DavidCrow2-Apr-13 4:34
memberDavidCrow2-Apr-13 4:34 
AnswerRe: Testing my first C driver Pin
Erudite_Eric3-Apr-13 0:45
memberErudite_Eric3-Apr-13 0:45 
AnswerRe: Testing my first C driver Pin
Erudite_Eric3-Apr-13 0:58
memberErudite_Eric3-Apr-13 0:58 
Questioncode conversion MATLAB to c Pin
Member 99587781-Apr-13 21:12
memberMember 99587781-Apr-13 21:12 
AnswerRe: code conversion MATLAB to c Pin
Chris Losinger2-Apr-13 7:49
memberChris Losinger2-Apr-13 7:49 
QuestionAccessing Win32 APIs from WinRT app through Win32 Dll Pin
msr_codeproject1-Apr-13 4:21
membermsr_codeproject1-Apr-13 4:21 
AnswerRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
Richard MacCutchan1-Apr-13 21:37
mvpRichard MacCutchan1-Apr-13 21:37 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
msr_codeproject1-Apr-13 23:17
membermsr_codeproject1-Apr-13 23:17 
AnswerRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
MicroVirus1-Apr-13 23:43
memberMicroVirus1-Apr-13 23:43 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
msr_codeproject2-Apr-13 1:03
membermsr_codeproject2-Apr-13 1:03 
GeneralRe: Accessing Win32 APIs from WinRT app through Win32 Dll Pin
MicroVirus3-Apr-13 10:41
memberMicroVirus3-Apr-13 10:41 
QuestionCreating an array of global Labels at runtime Pin
Douglas Kirk31-Mar-13 12:08
memberDouglas 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 Pin
Richard MacCutchan31-Mar-13 13:54
mvpRichard MacCutchan31-Mar-13 13:54 
GeneralRe: Creating an array of global Labels at runtime Pin
Douglas Kirk31-Mar-13 14:08
memberDouglas Kirk31-Mar-13 14:08 
GeneralRe: Creating an array of global Labels at runtime Pin
ThePhantomUpvoter31-Mar-13 14:12
memberThePhantomUpvoter31-Mar-13 14:12 
GeneralRe: Creating an array of global Labels at runtime Pin
Douglas Kirk31-Mar-13 14:28
memberDouglas Kirk31-Mar-13 14:28 
GeneralRe: Creating an array of global Labels at runtime Pin
ThePhantomUpvoter31-Mar-13 15:16
memberThePhantomUpvoter31-Mar-13 15:16 
QuestionWhere to post/share example? Pin
ReturnVoid30-Mar-13 1:45
memberReturnVoid30-Mar-13 1:45 
AnswerRe: Where to post/share example? Pin
ThePhantomUpvoter30-Mar-13 2:29
memberThePhantomUpvoter30-Mar-13 2:29 
AnswerRe: Where to post/share example? Pin
Pravinda Amarathunge30-Mar-13 3:27
memberPravinda Amarathunge30-Mar-13 3:27 
QuestionHow to control the other app using Window API Pin
Member 916988729-Mar-13 4:16
memberMember 916988729-Mar-13 4:16 
AnswerRe: How to control the other app using Window API Pin
dusty_dex29-Mar-13 4:27
memberdusty_dex29-Mar-13 4:27 
GeneralRe: How to control the other app using Window API Pin
Member 916988729-Mar-13 5:38
memberMember 916988729-Mar-13 5:38 
AnswerRe: How to control the other app using Window API Pin
Richard MacCutchan29-Mar-13 5:59
mvpRichard MacCutchan29-Mar-13 5:59 
AnswerRe: How to control the other app using Window API Pin
Erudite_Eric31-Mar-13 5:04
memberErudite_Eric31-Mar-13 5:04 
QuestionIs someone willing? Pin
Tyler Candee29-Mar-13 2:36
memberTyler Candee29-Mar-13 2:36 
AnswerRe: Is someone willing? Pin
Richard MacCutchan29-Mar-13 3:39
mvpRichard MacCutchan29-Mar-13 3:39 
GeneralRe: Is someone willing? Pin
Tyler Candee29-Mar-13 8:13
memberTyler Candee29-Mar-13 8:13 
QuestionShell Link Properties [SOLVED] Pin
Richard Andrew x6428-Mar-13 15:48
memberRichard Andrew x6428-Mar-13 15:48 
QuestionAddSourceFilter - passing file path paramater Pin
Vaclav_Sal28-Mar-13 11:47
memberVaclav_Sal28-Mar-13 11:47 
AnswerRe: AddSourceFilter - passing file path paramater Pin
Richard MacCutchan28-Mar-13 22:41
mvpRichard MacCutchan28-Mar-13 22:41 
RantISamplerGrabber future ?? Pin
Vaclav_Sal26-Mar-13 8:01
memberVaclav_Sal26-Mar-13 8:01 
GeneralRe: ISamplerGrabber future ?? Pin
Richard MacCutchan26-Mar-13 9:17
mvpRichard MacCutchan26-Mar-13 9:17 
GeneralRe: ISamplerGrabber future ?? Pin
Chris Losinger27-Mar-13 5:03
memberChris Losinger27-Mar-13 5:03 
GeneralRe: ISamplerGrabber future ?? Pin
Richard MacCutchan27-Mar-13 5:15
mvpRichard MacCutchan27-Mar-13 5:15 
GeneralRe: ISamplerGrabber future ?? Pin
Joe Woodbury26-Mar-13 9:26
memberJoe Woodbury26-Mar-13 9:26 
GeneralRe: ISamplerGrabber future ?? Pin
SoMad26-Mar-13 11:57
memberSoMad26-Mar-13 11:57 
GeneralRe: ISamplerGrabber future ?? Pin
Vaclav_Sal28-Mar-13 12:14
memberVaclav_Sal28-Mar-13 12:14 
GeneralRe: ISamplerGrabber future ?? Pin
SoMad28-Mar-13 20:34
memberSoMad28-Mar-13 20:34 
QuestionTurbo code implementation in C++ Pin
Manoj739025-Mar-13 20:50
memberManoj739025-Mar-13 20:50 
AnswerRe: Turbo code implementation in C++ Pin
Jochen Arndt25-Mar-13 22:09
memberJochen Arndt25-Mar-13 22:09 
GeneralRe: Turbo code implementation in C++ Pin
vikrams25-Mar-13 22:39
membervikrams25-Mar-13 22:39 
GeneralRe: Turbo code implementation in C++ Pin
vikrams25-Mar-13 23:17
membervikrams25-Mar-13 23:17 
QuestionHow can i create a project that it has the same name with an existing project Pin
November 201325-Mar-13 5:33
memberNovember 201325-Mar-13 5:33 
QuestionRe: How can i create a project that it has the same name with an existing project Pin
DavidCrow25-Mar-13 6:17
memberDavidCrow25-Mar-13 6:17 
AnswerRe: How can i create a project that it has the same name with an existing project Pin
November 201326-Mar-13 2:56
memberNovember 201326-Mar-13 2:56 
AnswerRe: How can i create a project that it has the same name with an existing project Pin
Richard MacCutchan25-Mar-13 7:32
mvpRichard MacCutchan25-Mar-13 7:32 
GeneralRe: How can i create a project that it has the same name with an existing project Pin
November 201326-Mar-13 4:03
memberNovember 201326-Mar-13 4:03 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 29 Sep 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid