Solved

vb datagridview with unbound column

Posted on 2013-12-04
3
400 Views
Last Modified: 2013-12-06
I have a datagridview in an application that displays open invoice amounts.  I'm storing data in an MS SQL database.  I created an unbound column for entry of payment amounts against an open invoice.  Upon "submitting" a process is run that applies the payment amount against the open invoice and this works fine.  However, if the user has entered an incorrect payment amount and hits delete to clear the field an exception is thrown, system.formatexception, "input string not in a correct format".  I have not been able to find a way to prevent this from happening.
0
Comment
Question by:GregorySinger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39698378
The fix will depend on what you're using to determine the field has changed, but it appears you're looking at the value of the unbound field and failing when it's empty.  Trapping for an empty field and bypassing any activity requiring it to be populated would seem like the obvious thing to do.

Is it this unbound field the error refers to?  What are you trying to do with that value when the error occurs?
0
 

Author Comment

by:GregorySinger
ID: 39701069
Yes, it appears to be the origin of the error. I'd like to have a message
Box appear to alert the user. How to trap the error is the issue. TNX.
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 500 total points
ID: 39701395
Wrap the code in a Try...CatchTry...Catch.  

Unless the code is inline with the page you can't just pop up a message, but you can throw the error onto the page itself, or have the code e-mail you the error.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question