Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6732473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:39:19+00:00 2026-05-26T10:39:19+00:00

Using VB.Net If the grid cell value is empty, i am getting error as

  • 0

Using VB.Net

If the grid cell value is empty, i am getting error as “Conversion from string “” to type ‘Double’ is not valid”

Code (gridview_CellLeave)

Dim z1, z2, z3, z4 As Int32


        If grvList.CurrentRow.Cells(1).Value <> "" Then
            z1 = grvList.CurrentRow.Cells(1).Value
        End If
        If grvList.CurrentRow.Cells(2).Value <> "" Then
            z2 = grvList.CurrentRow.Cells(2).Value
        End If
        If grvList.CurrentRow.Cells(3).Value <> "" Then
            z3 = grvList.CurrentRow.Cells(3).Value
        End If
        If grvList.CurrentRow.Cells(4).Value <> "" Then
            z4 = grvList.CurrentRow.Cells(4).Value
        End If

How to solve this error.

Need Vb.net code Help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:39:20+00:00Added an answer on May 26, 2026 at 10:39 am

    as suggested, use the TryParse method, thus avoiding also use the try / catch, because that method already handles any format errors.

     Dim z1, z2, z3, z4 As Int32
    
        If Integer.TryParse(grvList.CurrentRow.Cells(1).Value, z1) Then
            'your code here
        End If
    
         Dim z1, z2, z3, z4 As Double
    
        If Double.TryParse(grvList.CurrentRow.Cells(1).Value, z1) Then
            'your code here
        End If
    

    and so all other

    Regards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to assign a cell value to a grid view control cell from a
i am using grid view in vb.net. here is code... If Not DataGridView1.SelectedRows.Count =
Hi All, I am binding the SSN value to the grid using ASP.net which
If you are using ASP.NET MVC how are you doing grid display? Rolled your
I am using vb.net code. I have grid view, please see the code below:
I am using ASP.NET 2.0 and VS 2005. I need to populate a grid
I'm using the Contrib Grid for ASP.NET MVC and I was wondering if there
Using .Net 3.0 and VS2005. The objects in question are consumed from a WCF
Using .Net and Oracle 11g - I've been returning dataTables from a procedure inside
Using the ASP.NET grid view. It displays 3 columns with 1 row for each,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.