Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 621581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:53:26+00:00 2026-05-13T18:53:26+00:00

I am currently developing an application for an angle measurement device (goniometer). A DataGridView

  • 0

I am currently developing an application for an angle measurement device (goniometer).
A DataGridView component is used for configuring nominal values (and tolerances) for the measured angles. The user shall be able to enter the angles in various ways, such as 2° (for degrees) or 120′ (for minutes of arc) or 7200″ (for arcseconds). For this I created a parser which will convert a valid string to the angular value (a double, in degree) or fail if the string is not valid.

As I understand the correct point of time to invoke the parser is during handling of the CellParsing event. But how do I correctly handle the case when parsing has failed?

According to MSDN sample code I get the idea that I should leave the ParsingApplied property of the DataGridViewCellParsingEventArgs (which is passed to the CellParsing handler) set to false. If I do this (and leave the Value property unchanged) a FormatException is thrown by conversion attempts that are then done by the framework which raises the DataError event.
Instead of a FormatException which contains a rather unspecific error message I would like to have an exception which contains information about the specific error which caused my parser implementation to fail so that I can show a specific error message in the DataError event. I assumed that I can throw a FormatException myself from within the CellParsing handler but this exception is not caught by the framework and thus does not result in raising the DataError event (in fact the outmost exception handler terminates the application).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:53:26+00:00Added an answer on May 13, 2026 at 6:53 pm

    The DataGridView data errors are a nightmare to get the hang of.
    I’ve had to deal with this a lot recently, and in the end I just gave up and made my own implementation of DataGridViewColumn and DataGridViewCell. Doing so avoids all parsing errors, as you specifically handle it all yourself within your cell’s ParseFormattedValue method.

    My experience with all of this was turbulent but very worthwhile, as now I have a user interface that allows many different types of data to be input into a cell.

    You can see some code I came up with to do this in a question I posted on MSDN here.
    You can adapt that to match your own formatting (hopefully you can see what it’s doing).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 372k
  • Answers 372k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer foo="$(scriptthatprintssomething)" That's it. print. Or sys.stdout.write(). Or the like. If… May 14, 2026 at 7:13 pm
  • Editorial Team
    Editorial Team added an answer In the InitializeCommands method, without creating the Update and Delete… May 14, 2026 at 7:13 pm
  • Editorial Team
    Editorial Team added an answer You could do this using two left joins and regular… May 14, 2026 at 7:13 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.