expression must have pointer-to-object or handle-to-C++/CLI-array type Problem

  • Thread starter Thread starter HotIndigo
  • Start date Start date
H

HotIndigo

Guest
Hi,

I'm using Visual Studio 2017 to set up an image array. I have written most of the routines but one gives me the error in the title line. I have searched everywhere for a possible solution but I have not been able to solve it yet. There are 2 files: NS32.h and MyMain.cpp. The essential code is:

NS32.h:

#pragma once

#include <Windows.h>

namespace NS32 {

public ref class PictureBoxArray : public CollectionBase
{
public:
System::Windows::Forms::PictureBox^ AddNewPictureBox(Panel ^HostPanel, int Info)
{
// Routine to add a PictureBox item to a PictureBox array.
System::Windows::Forms::PictureBox ^aPictureBox = gcnew System::Windows::Forms::PictureBox();
// Add the button to the collection's internal list.
this->List->Add(aPictureBox);
// Add the label to the controls collection of the form referenced by the HostPanel field.
HostPanel->Controls->Add(aPictureBox);
// Set initial PictureBox element properties.
aPictureBox->Top = Info;
aPictureBox->Width = 28;
aPictureBox->Enabled = false;
aPictureBox->Visible = false;
int Cou = PictureBoxArray::Count - 1;
aPictureBox->Tag = Cou;
aPictureBox->Left = Info + Cou * 28;
return aPictureBox;
}

property int Item[int]
{
int get(int index)
{
return ((int) (List[index]));
}

void set(int index, int value)
{
List[index] = value;
}
}
}; // End of Class PictureBoxArray //

public ref class fgl : public System::Windows::Forms::Form
{
//#Region "Windows Form Designer generated code "
public:
virtual ~fgl()
{
this->Dispose(true);
delete components;
delete pd;
}

private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
//void InitializeComponent();
void InitializeComponent()
{
};

public:
static PictureBoxArray^ pd = gcnew PictureBoxArray; // Picture Box Array.

}; // End of Class fgl //

} // End of NameSpace NS32 //



The error appears in MyMain.cpp:

#include "NS32.h"

namespace NS32 {

void ShowPics(std::vector<bool> &Table)
{

using NS32::fgl;

for (int i = 0; i <= 8; i++)
{
if (Table)
{
NS32::fgl::pd->Visible = true;
// Error Here = E2242 expression must have pointer-to-object or handle-to-C++/CLI-array type
}
}
};
} // End of NameSpace NS32 //


Any clues or pointers would be very welcome. Many thanks.

Continue reading...
 
Back
Top