1

I want to get the object from my DataGridView which is a lon- resp. latitude-value (ex. 5.5186) converted to a double value. But I will get 55186 (from the example) without the decimal. How can I fix this?

    private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
    {
      ...
      double lon = Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[2].Value);
      double lat = Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[3].Value);
      ...
    }
flyingAlemannian
  • 175
  • 2
  • 13
  • @fubo This doesn't look to me as the same problem. – Zoran Horvat Feb 27 '18 at 12:50
  • 2
    @ZoranHorvat because? same input, same result, same method, same error... – fubo Feb 27 '18 at 12:52
  • @fubo thx. haven't found the answer you were posting. It is the same problem although I need to convert object to string first. – flyingAlemannian Feb 27 '18 at 12:54
  • 1
    @fubo But not the same call. I would rather point to the *answer* as being the answer to this question, but not the entire question. – Zoran Horvat Feb 27 '18 at 12:55
  • Can you edit the question and put the explicit values of `Cells[2].Value` and `Cells[3].Value`? Also, what locale is your current? E.g., if you're set to a German locale and trying to parse a `.`, it's not going to work (hence the mark as duplicate I suspect). – DiskJunky Feb 27 '18 at 17:15
  • @DiskJunky the values are already in the question. Those are latitude and longitude double values, doesn't matter which explicit value that is. I am using the official used spelling of the coordinates (decimal is a dot) And second, the question is already answered. The link is on top of my question (marked as duplicate by fubo). – flyingAlemannian Feb 28 '18 at 10:35

0 Answers0