R
R
Reslyukov Alexander2022-03-29 16:18:19
Windows Forms
Reslyukov Alexander, 2022-03-29 16:18:19

How to fix the following errors in the code?

According to the assignment, you need to do a simple test, after which the number of points received during the test is displayed. I'm using VS2019, CLR project (.NET Framework)
I wanted to write the calculation of points in the properties of the "Finish" button, however I don't know C++ case in Windows.Forms well, from the examples there was only something similar in C#.

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  int bal = 0;
  if (radioButton4_CheckedChanged) bal = bal + 1;
  if (radioButton6_CheckedChanged) bal = bal + 1;
  if (radioButton10_CheckedChanged) bal = bal + 1;
  if (radioButton14_CheckedChanged) bal = bal + 1;
  if (radioButton19_CheckedChanged) bal = bal + 1;
  if (checkBox1_CheckedChanged && checkBox2_CheckenChanged) bal = bal + 1;
  if (checkBox5_CheckedChanged && checkBox7_CheckenChanged) bal = bal + 1;
  if (checkBox9_CheckedChanged && checkBox10_CheckenChanged) bal = bal + 1;
  if (checkBox15_CheckedChanged && checkBox4_CheckenChanged) bal = bal + 1;
}

The first introduced radioButton and checkBox have the error :
"E2071 - The element pointer is not valid for the managed class."
All subsequent radioButton and checkBox are undefined:
"E0020 - Identifier 'radioButton6_CheckedChanged' is not defined."
And, if possible, tell me how to display the score in the label. I saw the label.Text = "..." command in C#, but I didn't even find something similar in C++, although the same commands for checkboxes and radio buttons are almost identical, only an underscore is put instead of a dot.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
calculator212, 2022-03-29
@calculator212

All subsequent radioButton and checkBox are undefined: identifier "radioButton6_CheckedChanged" is undefined".
Well, they even tell you in Russian that you don’t have such variables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question