Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > C/C++ программирование > Visual C++
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 03.04.2018, 00:57   #1
NIKITAY
Пользователь
 
Регистрация: 30.01.2016
Сообщений: 34
По умолчанию Выражение должно иметь тип класса

Код:
            this->radioButton2->AutoSize = true;
            this->radioButton2->Location = System::Drawing::Point(154, 27);
            this->radioButton2->Name = L"radioButton2";
            this->radioButton2->Size = System::Drawing::Size(84, 21);
            this->radioButton2->TabIndex = 13;
            this->radioButton2->Text = L"Угол";
            this->radioButton2->UseVisualStyleBackColor = true;
            this->radioButton2->CheckedChanged += gcnew System::EventHandler(this, &MyForm::radioButton2_CheckedChanged);
            // 
            // radioButton3
            // 
            this->radioButton3->AutoSize = true;
            this->radioButton3->Location = System::Drawing::Point(7, 25);
            this->radioButton3->Name = L"radioButton3";
            this->radioButton3->Size = System::Drawing::Size(101, 21);
            this->radioButton3->TabIndex = 14;
            this->radioButton3->Text = L"Высота";
            this->radioButton3->UseVisualStyleBackColor = true;
            this->radioButton3->CheckedChanged += gcnew System::EventHandler(this, &MyForm::radioButton3_CheckedChanged);
            // 
            // radioButton4
            // 
            this->radioButton4->AutoSize = true;
            this->radioButton4->Location = System::Drawing::Point(154, 56);
            this->radioButton4->Name = L"radioButton4";
            this->radioButton4->Size = System::Drawing::Size(59, 21);
            this->radioButton4->TabIndex = 17;
            this->radioButton4->Text = L"Пр.";
            this->radioButton4->UseVisualStyleBackColor = true;
            this->radioButton4->CheckedChanged += gcnew System::EventHandler(this, &MyForm::radioButton4_CheckedChanged);
            // 
            // groupBox6
            // 
            this->groupBox6->Controls->Add(this->radioButton2);
            this->groupBox6->Controls->Add(this->radioButton4);
            this->groupBox6->Controls->Add(this->radioButton3);
            this->groupBox6->Controls->Add(this->radioButton1);
            this->groupBox6->Location = System::Drawing::Point(724, 9);
            this->groupBox6->Name = L"groupBox6";
            this->groupBox6->Size = System::Drawing::Size(265, 83);
            this->groupBox6->TabIndex = 19;
            this->groupBox6->TabStop = false;
            this->groupBox6->Text = L"Параметры";
            // 
            // MyForm
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(993, 589);
            this->Controls->Add(this->groupBox6);
            this->Controls->Add(this->groupBox2);
            this->Controls->Add(this->label10);
            this->Controls->Add(this->button3);
            this->Controls->Add(this->chart1);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->groupBox4);
            this->Controls->Add(this->groupBox3);
            this->Controls->Add(this->groupBox1);
            this->Name = L"MyForm";
            this->Text = L"MyForm";
            this->groupBox1->ResumeLayout(false);
            this->groupBox1->PerformLayout();
            this->groupBox3->ResumeLayout(false);
            this->groupBox3->PerformLayout();
            this->groupBox4->ResumeLayout(false);
            this->groupBox4->PerformLayout();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->EndInit();
            this->groupBox2->ResumeLayout(false);
            this->groupBox2->PerformLayout();
            this->groupBox6->ResumeLayout(false);
            this->groupBox6->PerformLayout();
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    }
private: System::Void textBox9_TextChanged(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void label10_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void radioButton1_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
 
}
private: System::Void radioButton3_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
    
}
private: System::Void radioButton2_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
    
}
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
 
    TState M;
    double step, x,y;
 
 
    int variant;
 
    if (radioButton4.Checked == true) {
        variant = 4;
    }
 
    if (radioButton1.Checked == true) {
        variant = 3;
    }
 
 
    if (radioButton3.Checked == true) {
        variant = 1;
    }
 
 
    if (radioButton2.Checked == true) {
        variant = 2;
    }
//расчеты
 
}
 
private: System::Void radioButton4_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
 
}
private: System::Void textBox12_TextChanged(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void label13_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
}
};
}
выдает ошибку на этом месте
if (radioButton2.Checked == true) {
variant = 2;
}
выражение должно иметь тип класса

_____
Код программы нужно выделять (форматировать) тегами [CODE] (читать FAQ)
Модератор

Последний раз редактировалось Serge_Bliznykov; 03.04.2018 в 09:04.
NIKITAY вне форума Ответить с цитированием
Старый 03.04.2018, 07:33   #2
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,695
По умолчанию

Если они описаны не в классе, то и обращаться надо через объект, например, form1
p51x вне форума Ответить с цитированием
Старый 03.04.2018, 08:49   #3
NIKITAY
Пользователь
 
Регистрация: 30.01.2016
Сообщений: 34
По умолчанию

Цитата:
Сообщение от p51x Посмотреть сообщение
Если они описаны не в классе, то и обращаться надо через объект, например, form1

если не сложно, можете код скинуть?
NIKITAY вне форума Ответить с цитированием
Старый 03.04.2018, 09:39   #4
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,695
По умолчанию

Не могу. У меня нет вашего кода.
p51x вне форума Ответить с цитированием
Старый 03.04.2018, 10:59   #5
Black Fregat
Программист
Участник клуба
 
Аватар для Black Fregat
 
Регистрация: 23.06.2009
Сообщений: 1,772
По умолчанию

У Вас же C++/CLI, там это пишется через стрелку:
Код:
if (radioButton2->Checked) {
  variant = 2;
}
Black Fregat вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
как указатель в классе может указывать на другой узел списка если он имеет тип самого этого класса? EricJForster Общие вопросы C/C++ 1 08.07.2016 00:13
C++ в чем проблема? Не могу обратиться к элементам массива A. Пишет "выражение должно иметь тип указателя" Praud Помощь студентам 3 04.05.2014 18:53
Зачем у "TStringList" свойству "Count" иметь знаковый тип (Integer) ? malor Общие вопросы Delphi 15 27.04.2013 13:39
Выражение должно иметь константное значение? Си snqL Общие вопросы C/C++ 6 14.10.2011 22:12
строковое выражение числа должно быть переведено в вещественный тип Wi1D Помощь студентам 8 09.02.2009 18:16