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 632963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:08:00+00:00 2026-05-13T20:08:00+00:00

I have a DataGridView bound to a DataTable in a DataSet . I set

  • 0

I have a DataGridView bound to a DataTable in a DataSet.

I set all columns of the DataTable to System.Double.

I want the last row of the DataGridView to display "PASS" or "FAIL" depending on some condition of the values in that column.

How do I do this?

Ideas:
lastCell = IIF(condition, Double.PositiveInfinity, Double.NegativeInfinity)
Then, apply some conditional formatting (Inf -> PASS, -Inf -> FAIL) to the final row of the DataGridView.

  • 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-13T20:08:01+00:00Added an answer on May 13, 2026 at 8:08 pm

    You could probably create and use a custom NumberFormatInfo, setting PositiveInfinitySymbol and NegativeInfinitySymbol to the strings you want.

    But I’d say it would be better to do something like this in the DataGridView.CellFormatting event handler – which makes it much clearer what you’re doing and why, and won’t have undesirable side effects e.g. if another cell happens to have an infinite value because of a division by zero.

    Something like the following air code:

    void dataGridView1_CellFormatting(object sender, 
        DataGridViewCellFormattingEventArgs e)
    {
        if ((e.ColumnIndex == whatever) && (c.RowIndex == whatever))
        {
            // ... comment explaining what you're doing
            if (condition)
            {
                e.Value = "PASS";
            }
            else
            {
               e.Value = "FAIL";
            }
            e.FormattingApplied = true;
        }
    }
    

    Apologies for the C# code given you’ve tagged the question VB.NET, but you’ll find a VB.NET sample in the MDSN documentation for the CellFormatting event.

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

Sidebar

Related Questions

I have a DataGridView that's bound to a DataSet. It has columns DateCreated, Weight,
I have a datatable bound to a winforms dataGridView via a BindingSourceControl. I want
I have a DataGridView bound to a DataTable that has 1+16 columns defined as
I have a DataGridView bound to a DataSet. I only want a selection of
I have a datatable bound to my datagridview. One of the columns is a
I have a datagridview bound to a datatable. One of the columns in the
I have a datatable bound to a datagridview. However, the ordering of columns is
I have a DataTable which is bound to DataGridView . DataTable has several columns
I have a DataTable which is bound to datagridview (Winforms)... I use the following
I have a DataGridView bound to a LINQ to SQL query expression. I want

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.