6 Replies - 3140 Views - Last Post: 31 January 2012 - 01:54 AM

#1 seker85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 18-January 12

Error when converting

Posted 30 January 2012 - 06:28 AM

Hi,

I get an error when I try to convert this to double.
"error C2664: 'void system::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'double' to 'System::String ^'

#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			
	 
	this->textBox3->Text = System::Convert::ToDouble
	
       (System::Convert::ToDouble(this->textBox1->Text) /

       ((System::Convert::ToDouble(this->textBox2->Text))/100)/((System::Convert::ToDouble(this->textBox2->Text))/100));
		}


Can someone help?

This post has been edited by jimblumberg: 30 January 2012 - 07:27 AM
Reason for edit:: Added missing Code Tags, Please learn to use them.


Is This A Good Question/Topic? 0
  • +

Replies To: Error when converting

#2 kevindckr  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 105
  • Joined: 09-January 12

Re: Error when converting

Posted 30 January 2012 - 06:29 AM

Put it in a [c0de][/c0de] bracket.
Was This Post Helpful? 0
  • +
  • -

#3 seker85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 18-January 12

Re: Error when converting

Posted 30 January 2012 - 06:41 AM

#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			
			// To Convert the Result of Text Box 1 and 2 to Double & Move it to Text Box 3. 
			this->textBox3->Text = System::Convert::ToString
			// Covert the Data in Text Box 1 to Double.
			(System::Convert::ToDouble(this->textBox1->Text)
			// Covert the Data in Text Box 2 to Double & Divide it with Text Box 2.
			/ ((System::Convert::ToDouble(this->textBox2->Text))/100)/((System::Convert::ToDouble(this->textBox2->Text))/100));
		
			catch (System::Exception^ exp) {
             // Display Error in Text Box 3
			this->textBox3->Text = "Error";
			}
	}


This post has been edited by jimblumberg: 30 January 2012 - 07:26 AM
Reason for edit:: Fixed Code tags.

Was This Post Helpful? 0
  • +
  • -

#4 kevindckr  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 105
  • Joined: 09-January 12

Re: Error when converting

Posted 30 January 2012 - 07:02 AM

'/' not '\', If you look really closely, its all over the site. It is the background to the text box you type in when posting even.
Was This Post Helpful? 0
  • +
  • -

#5 jimblumberg  Icon User is offline

  • member icon


Reputation: 4098
  • View blog
  • Posts: 12,682
  • Joined: 25-December 09

Re: Error when converting

Posted 30 January 2012 - 07:33 AM

Please post the complete error message, this messages should tell you on what line the error is detected.

Jim
Was This Post Helpful? 0
  • +
  • -

#6 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Error when converting

Posted 30 January 2012 - 07:41 AM

This should not have been moved to C#. I have moved it back to the C/C++ forum. If it needs to go somewhere else, let me know.

EDITED: moved it to the CLI C++ forum.
Was This Post Helpful? 0
  • +
  • -

#7 seker85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 18-January 12

Re: Error when converting

Posted 31 January 2012 - 01:54 AM

The error is:
"error C2664: 'void system::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'double' to 'System::String ^'" ... and refers to line 09 in this code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1