Display only 2 digs in string in label.
-
That does not look like C++/CLI code to me; more like C#. I guess you didn't look too closely at the example code[^].
Use the best guess
I am using Microsoft Visual Studio 2010
-
I am using Microsoft Visual Studio 2010
-
And what is the relevance of that? You do realise that Visual Studio is a development environment and not a programming language?
Use the best guess
Be cource the errorcodes I got was from MS Visual C++ 2010. I thought it might explain to you why I got thoose errorcodes in C++. Its C++ I am Using.
-
Be cource the errorcodes I got was from MS Visual C++ 2010. I thought it might explain to you why I got thoose errorcodes in C++. Its C++ I am Using.
-
This is the C++/CLI forum; which are you using, C++/CLI or unmanaged C++?
Use the best guess
I have no idea. Thought I could get some help here ?
-
I have no idea. Thought I could get some help here ?
Søren Lyder Nielsen wrote:
I have no idea.
Seriously? You are writing a program and you do not know what language or framework you are using? I don't know how you expect us to help if you cannot answer such a basic question. I would suggest you make a decision which language you plan to use and get hold of a book to learn the basics of it before trying anything else.
Use the best guess
-
Søren Lyder Nielsen wrote:
I have no idea.
Seriously? You are writing a program and you do not know what language or framework you are using? I don't know how you expect us to help if you cannot answer such a basic question. I would suggest you make a decision which language you plan to use and get hold of a book to learn the basics of it before trying anything else.
Use the best guess
Thanks for the help. But i gotta say, I feel it a is waste of time to try and get anything usefull out of you. All I ask for, is that you write one line of code with my own data in C++. But instead i feel you blame me for not knowing anything, even though that was one of the first things i told you. I will try my luck some other time.
-
Thanks for the help. But i gotta say, I feel it a is waste of time to try and get anything usefull out of you. All I ask for, is that you write one line of code with my own data in C++. But instead i feel you blame me for not knowing anything, even though that was one of the first things i told you. I will try my luck some other time.
Søren Lyder Nielsen wrote:
All I ask for, is that you write one line of code with my own data in C++.
No, you have not asked that, you asked how to get a number formatted in a particular way in C++/CLI, and I referred you to the documentation that explains it in detail, with plenty of samples. It seems you are not prepared to spend the time reading it. You also do not seem to know exactly which language you are using, so I cannot answer the question, because it would be different for each language.
Søren Lyder Nielsen wrote:
But instead i feel you blame me for not knowing anything
Neither did I blame you for anything. I have done my best to help you but I cannot answer the question unless I get the proper facts to start with. As I said before, you need to decide which version of the language you are using and start studying it. Give us the proper facts and background to your problem and we will try to help, but you are expected to do some of the work for yourself.
Use the best guess
-
Hey. I am trying to get my program to display only 2 decimals of the result og an calculation. Code:
// Defination af input
dansk = System::Convert::ToDouble(textBox2->Text);
kurs = System::Convert::ToDouble(numericUpDown1->Text);// Udregningerne tysk = dansk / kurs; ti = tysk \* 0.90; femten = tysk \* 0.85; tyve = tysk \* 0.82; bdansk = tysk \* kurs \* 1.25; bti = tysk \* 0.90 \* 1.25; bfemten = tysk \* 0.85 \* 1.25; btyve = tysk \* 0.82 \* 1.25; btysk = tysk \* 1.18; //konvertering til udskrivning af resultat label7->Text = System::Convert::ToString(dansk) + " Kr"; label8->Text = System::Convert::ToString(ti) + " Kr"; label9->Text = System::Convert::ToString(femten) + " Kr"; label10->Text = System::Convert::ToString(tyve) + " Kr"; label14->Text = System::Convert::ToString(bdansk) + " Kr"; label15->Text = System::Convert::ToString(bti) + " Kr"; label16->Text = System::Convert::ToString(bfemten) + " Kr"; label17->Text = System::Convert::ToString(btyve) + " Kr"; label20->Text = System::Convert::ToString(tysk) + " Eur"; label21->Text = System::Convert::ToString(btysk) + " Eur";
My ints are defined another place in my prpgram. Right now my result will be something like 54.867563547, and not 54.86, as my wish is. Can you help ?
1 - convert them to float type , example : { double a = 2.1589687489; String^ b = Convert::ToString((float)a); } 2 - remove them , example : { double a = 2.1589687489; String^ b = Convert::ToString(a); b = b->remove(b->IndexOf('.')+2 ); }
-
1 - convert them to float type , example : { double a = 2.1589687489; String^ b = Convert::ToString((float)a); } 2 - remove them , example : { double a = 2.1589687489; String^ b = Convert::ToString(a); b = b->remove(b->IndexOf('.')+2 ); }