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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:53:44+00:00 2026-06-10T07:53:44+00:00

I have a datagridview. The dgv’s data source is a ‘ReadOnlyCollection’ of objects. One

  • 0

I have a datagridview. The dgv’s data source is a ‘ReadOnlyCollection’ of objects. One of the properties of the object in the ‘ReadOnlyCollection’ is a nullable ‘DateTime’. What I’m trying to do is show a blank cell where the ‘DateTime’ is null, but apply a different format to the DateTime column, by doing:

TimeOutColumn.DefaultCellStyle.Format = "MM/dd/yyyy HH:mm";

The only problem is that sets all of my null entries to the DateTime.Min value.

‘history’ is the ReadOnlyCollection.
Here’s the current code:

'DataGridViewTextBoxColumn TimeOutColumn = new DataGridViewTextBoxColumn();
            TimeOutColumn.DataPropertyName = "timeout";
            TimeOutColumn.HeaderText = "Time Out";                

            ddgGHistory.Columns.Add(BadgeTypeIDColumn);
            ddgGHistory.Columns.Add(EmployeeColumn);
            ddgGHistory.Columns.Add(TimeInColumn);
            ddgGHistory.Columns.Add(TimeOutColumn);

            ddgGHistory.DataSource = history

            ddgGHistory.Columns[3].DefaultCellStyle.Format = "MM/dd/yyyy HH:mm";
            ddgGHistory.Columns[3].DefaultCellStyle.NullValue = "";
  • 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-06-10T07:53:45+00:00Added an answer on June 10, 2026 at 7:53 am

    Since DateTime is a non-nullable object, it must have a value. However, it is possible to make DateTime nullable by declaring it as a nullable DateTime.

    The following is a non-nullable datetime, and will always have a value.

     DateTime dt = new DateTime();
    

    However,one can declare it as nullable by adding ? after the type.

    DateTime? nullable_dt = new DateTime?();
    

    Assuming that nullable_dt has been set to null, the datagridview will show an empty cell where the value from nullable_dt has been assigned.

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

Sidebar

Related Questions

I have one DataGridView named dgv . dgv is pretty much a plain gridview.
I have a datagridview that displays data from an XML file. The DGV is
I have an unbound DataGridView with one visible field. The user can copy data,
I have a datable myTable, which is bind with a DataGridView dgv. The DataGridView
Here's what I'm doing: I have (2) DataGridView controls DGV #1 is bound to
I have a DataGridView bound to a list of business objects: Dim template As
i have a DataGridView responsible for showing a bit of data and two of
I have a datagridview bound to a datatable. One of the columns in the
I have a WinForms application that contains a Dataset ds and a DataGridView dgv.
I have a DataGridView that is displaying a List of objects (not DataSet). Is

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.