Failed to return new code element, Possible syntax error

4.6k views Asked by At

I have 2 radio button under a group box and i made first one group as true. but when i am adding radio button variable the it showing message "Failed to return new code element possibly a syntax error", what would be the reason?

3

There are 3 answers

1
AudioBubble On BEST ANSWER

Delete the Class Wizard file (.clw) and the Intellisense file (.ncb) file from your solution directory and try again.

0
Sunscreen On

You need to have only one variable for your data and one for your control for your grouped Controls:

int m_RBData;
CRadio m_RBControl;

Then you need to group all ID Controls within the linked function like this:

ON_CONTROL_RANGE(BN_CLICKED,IDC_RB,IDC_RB3,OnClickRb)

You also need to add reference to String Table:

1R__C 0,1,2 in your first ID (IDC_RB).

Now your data variable, takes the values 0,1 or 2 whenever you click the first, the second or the third radio button respectively.

1
Jasper Li On

I meet this issue on VS 2022. I solved it by these steps:

  1. closing VS solution.
  2. delete .vs directory
  3. re-open *.sln