Home > front end >  Type name not allowed (Convert)
Type name not allowed (Convert)

Time:06-11

I have two textBox, a button and a textBox where the result will be

#pragma endregion
    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
        double x = 0;
        double y = 0;
        double z = 0;
        x = Convert.ToDouble(textBox1->Text);   
        y = Convert.ToDouble(textBox2->Text);
        z = x   y;
        textBox3->Text = Convert.ToString(z);
    }

"Convert" write error number E0254

"My question is about С "

CodePudding user response:

If ToDouble and ToString are static member functions then instead of

x = Convert.ToDouble(textBox1->Text);   
y = Convert.ToDouble(textBox2->Text);
textBox3->Text = Convert.ToString(z);

you need to write

x = Convert::ToDouble(textBox1->Text);   
y = Convert::ToDouble(textBox2->Text);
textBox3->Text = Convert::ToString(z);
  • Related