Solved

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

Posted on 2009-05-06
2
897 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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
Course of the Month6 days, 19 hours left to enroll

622 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