Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-05-06
2
Medium Priority
?
898 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
[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 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

715 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