Byte array in PropertyGrid

O

Olav Langeland

I have a C# Form with a System.Windows.Forms.PropertyGrid(). This uses a
Datagram class, implemented in both C# and C++:

// C#
public class Datagram
{
public byte[] _Buffer;

// some code...

public byte[] Buffer { get{return _Buffer;}
}

// C++
public __gc class Datagram
{
public:

unsigned char* _ucharBuf;
Byte _ByteBuf __gc[];

// some code...

public:
__property byte* get_Buffer1() {return _ucharBuf;}
__property Byte get_Buffer2() __gc[] {return _ByteBuf;}
__property unsigned char __gc *get_Buffer3() {return _ucharBuf;}
}

When I use the C# Datagram class, the Property Grid looks like this:

+ Buffer Byte[] Array ...

The "Byte Array Property Editor" is available when ... is clicked.

When I use the C++ datagram class, Property Grid looks like this:

Buffer1 System.Reflection.Pointer
+Buffer2 Byte[] Array
Buffer3 Specified method is not supported.

I assume the C++

__property Byte get_Buffer2() __gc[]

is the best match for the C# equivalent.

The "Byte Array Property Editor" seems to be unavailable when I use the C++
class. How can I get the C++ class to be compliant with the C# class?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top