Solved

system.format exception-Input string was not in a correct format

Posted on 2009-05-06
2
887 Views
Last Modified: 2012-06-27
I am trying to assign a value from the database to the second column of the data Grid View.Then it is throwing an error.Here is the error.

The same code worled perfectly fine when i tried to assign the values to the first column of the Grid.


For Each row As DataGridViewRow In Gridview1.Rows

                    If Not DBNull.Value.Equals(row.Cells.Item(0).Value) Then

row.Cells.Item(1).Value =abcdef

 Next

Open in new window

0
Comment
Question by:yuvaratna
2 Comments
 
LVL 5

Accepted Solution

by:
Aanvik earned 500 total points
Comment Utility
Can you try this?

row.Cells.Item(1).Value = "abcdef"

For Each row As DataGridViewRow In Gridview1.Rows

                    If Not DBNull.Value.Equals(row.Cells.Item(0).Value) Then

             row.Cells.Item(1).Value = "abcdef"

 Next

Open in new window

0
 

Author Comment

by:yuvaratna
Comment Utility
Nope! that didnt work
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 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

14 Experts available now in Live!

Get 1:1 Help Now