Solved

vb datagridview with unbound column

Posted on 2013-12-04
3
383 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
  • 2
3 Comments
 
LVL 33

Expert Comment

by:paulmacd
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 33

Accepted Solution

by:
paulmacd 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
This video discusses moving either the default database or any database to a new volume.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now