Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-05-06
2
Medium Priority
?
899 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 1500 total points
ID: 24318179
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
ID: 24318258
Nope! that didnt work
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

916 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