How to get the type of a struct member?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: How to get the type of a struct member?

  1. #1
    Join Date
    Jun 2012
    Posts
    37

    Question How to get the type of a struct member?

    Hi there! How are you?

    I have a struct that I created that looks like this:

    struct UI_Descriptor //(906 Bytes)
    {
    unsigned char mInput_Gain_L1;
    unsigned int mChannel_Attack_Txtb[4];
    float BW_OUT1_EQ[24];
    };

    UI_Descriptor Slot_1;
    UI_Descriptor Slot_2;
    UI_Descriptor Slot_3;

    I need to know what's the type of each member. So I tested the GetType() function but without success. For example:

    float whatever=0;
    Type^ varType;
    varType = whatever.GetType();
    textBox1->Text = varType->Name->ToString();

    That works fine. However, if I try to get the type of one of my struct members, it won't compile, for example:

    Type^ varType;
    varType = Slot_1.BW_OUT1_EQ.GetType();
    textBox1->Text = varType->Name->ToString();

    Is there anyway to get the type of my struct members? How about the member that is an array, would that be the same?

    Thank you very much!

    EDIT: Problem solved! I was mistaken trying to get the type of the array instead of one of its elements. It was my distraction, I apologize for the useless post. I'd like to ask to the Moderator to remove this thread please. Thank you!

    Best Regards,

    Fernando
    Last edited by fernando306; October 22nd, 2012 at 01:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center