Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Input string was not in a correct format.
 

Input string was not in a correct format.

When I add a piece of data into a cell in my DataGridView on my form, I get this error:

@p6 : Grace - Input string was not in a correct format.
System.FormatException was unhandled
Message=@p6 : Name - Input string was not in a correct format.
Source=System.Data

My code is shown below,



Public Class MonkeyList

Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
'Error occures following line.
Me.MonkeyListTableAdapter.Adapter.AcceptChangesDuringUpdate = True
Me.MonkeyListTableAdapter.Update(Me.MonkeyListDataSet1.MonkeyList)

Me.Close()
End Sub


How do i solve this?
  • Edited bybornapilot Thursday, July 23, 2009 1:32 PMElaboration
  • Edited bybornapilot Thursday, July 16, 2009 1:27 PM
  • Edited bybornapilot Monday, July 20, 2009 12:36 AM
  •  
bornapilot  Thursday, July 16, 2009 1:21 PM

Hi,

> When I add a piece of data into a cell in my table, I get this error:

By the "table", do you mean the DataGridView on the form or the DataTable in the application or the table in the DataBase?

Anyway, it seems that the data input is not in correct format, e.g. an int value is needed, but the input data is a string that can't be converted to an int value.


Please remember to mark the replies as answers if they help and unmark them if they provide no help. end us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
Linda Liu  Thursday, July 23, 2009 9:31 AM
Hi,
its problem with data ur passing from front end to database.ensure all data in correct datatype format...
cg
  • Proposed As Answer byGnanadurai Thursday, September 03, 2009 10:13 AM
  •  
Gnanadurai  Friday, July 24, 2009 7:40 AM

You can use google to search for other answers

Custom Search

More Threads

• Error During Connection To Remote sqlserver
• Positioning context menu over datagridview
• how can i check that the textbox value is string or not?
• Combobox list from a Collection in another control
• even
• How do I disable BindingSource (ControlUpdate) based on a criteria
• DataGridView: how to stop / cancel sorting
• DataGridView - Setting DataSource Fires RowEnter Event
• bind TreeView using xml
• Databinding: Updating database through Save button on binding navigator toolbar