0

Hi I discovered when I access a float value from mySQL database and convert it to System::String^ then it change for example 3.15 to 3,15 but I want it to output 3.15 how do I do that. This is the code:

DataGridViewRow^ row = gcnew DataGridViewRow();
row->CreateCells(this->dataGridView1);
row->Cells[3]->Value = myReader->GetFloat(3);
this->dataGridView1->Rows->Add(row);

I have also tested: row->Cells[5]->Value = ("%f",myReader->GetFloat(5)); but it still give me a number with a comma for the decimal separator but I want a dot.

1

1 Answer 1

1

Try this:

using namespace System::Globalization;

row->Cells[3]->Value = myReader->GetFloat(3).ToString(CultureInfo::InvariantCulture);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.