none
Datagridview row colour changed based on cell value works ok until sorted

    Question

  • Hello,

     

    I have a datagridview filled from SQL with tasks to be carried out.  The tasks may or may not have a due date.  If the due date is not set it will be DBNull.  I am using this code to change the colour of the row if the task has a due date and it has passed to highlight late and very late tasks.  This all works fine until the datagridview is sorted by due date descending, then all of the rows are coloured as very late, whereas only one of them is actually late.  I can sort of fix this by only colouring the due date cell, but that is not how I want to interface to work.  How can I fix this?

     

    Thanks,

    CB

     

    The code is below:

     

    Code Snippet

    private void dataGridViewCreatedByMe_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)

    {

    try

    {

    if ((m_bFormLoaded == false) || (e.Value == null))

    return;

     

    if (this.dataGridViewCreatedByMe.Columns[e.ColumnIndex].Name == "Due_Date")

    {

    System.Diagnostics.Debug.WriteLine("Value is _" + e.Value + "_");

    if (e.Value != System.DBNull.Value)

    {

    TimeSpan tsDiff = DateTime.Now.Subtract((DateTime)e.Value);

    if ((tsDiff.TotalHours > Properties.Settings.Default.VeryLateHours))

    {

    dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

    dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.BackColor = Properties.Settings.Default.VeryLateColour;

    //e.CellStyle.ForeColor = Color.White;

    //e.CellStyle.BackColor = Properties.Settings.Default.VeryLateColour;

    }

    else if ((tsDiff.TotalHours > Properties.Settings.Default.LateHours))

    {

    dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

    dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.BackColor = Properties.Settings.Default.LateColour;

    }

    }

    }

    }

    catch (Exception ex)

    {

    }

    }

     

     

    Friday, August 22, 2008 5:24 PM

Answers

  • Hi Chinnybloke,

    It’s really great you’ve found the problem. I’m sure you’ve taken great effort in finding the cause. Now I can also reproduce the problem when I set AutoSizeRowsMode to DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders. After half days’ debugging, I found regularity that all the rows were colored with the color of first row when we sort descend. Therefore, I worked out by changing the color back with the following code. It works well in my side.

    Code Snippet

            void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

            {

                if (dataGridView1.Columns[e.ColumnIndex].Name == "DueDate" && e.Value != null)

                {

                    if (e.Value != DBNull.Value)

                    {

                        TimeSpan ts = DateTime.Now.Subtract((DateTime)e.Value);

                        if (ts.TotalHours > 48)//if ts.TotalHours>48, mark as very late.

                        {

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;

                        }

                        else if (ts.TotalHours > 24)//if ts.TotalHours>24,mark as late.

                        {

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Blue;

                        }

                    }

                        /* Newly added branch */

                    else

                    {

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = SystemColors.Window;

                    }

                }

     

            }

     

    I hope the code can help you get out of frustrating. Looking for your testing result.

    Best Regards,

    Bruce Zhou

     

    Windows Forms General FAQs
    Windows Forms Data Controls and Databinding FAQs

     

    Friday, August 29, 2008 5:20 AM

All replies

  • Hi chinnybloke,

     

    As far as I can understand, the problem you are facing is “Rows were marked wrong when you sorted the DueDate column”.

     

    I have made a simple application to reproduce your problem, but the code runs well. The following is the table structure.

    ┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┓

    ┃      TaskID(int)               TaskName(varchar(10))                 DueDate(DateTime)      ┃
    ┝┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┫
    ┃      1                                    task1                              8/27/2008 12:00:00 AM     ┃
    ┝┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┫
    ┃      2                                    task2                              8/26/2008 12:00:00 AM     ┃
    ┝┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┫
    ┃      3                                    task3                              8/25/2008 12:00:00 AM     ┃
    ┝┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┫
    ┃      4                                    task4                              8/24/2008 12:00:00 AM     ┃
    ┝┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┫
    ┃      5                                    task5                              8/26/2008 12:00:00 AM     ┃
    ┝┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┫
    ┃      6                                    task6                                            null                    ┃
    ┗┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┛

    The following is the corresponding code.

     

    Code Snippet

            private static string conn = @"*******************************************";

            private static string sql="select * from Task";

            private static SqlDataAdapter sda = new SqlDataAdapter(sql, conn);

            public Form1()

            {

                InitializeComponent();

                DataSet ds = new DataSet();

                sda.Fill(ds);

                this.dataGridView1.DataSource = ds.Tables[0];

                this.dataGridView1.CellFormatting += new    DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);

            }

            void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

            {

                if (dataGridView1.Columns[e.ColumnIndex].Name == "DueDate" && e.Value!=null && e.Value!=DBNull.Value)

                {

                    TimeSpan ts = DateTime.Now.Subtract((DateTime)e.Value);

                    if (ts.TotalHours > 48)//if ts.TotalHours>48, mark as very late.

                    {

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor=Color.White;

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;

                    }

                    else if (ts.TotalHours > 24)//if ts.TotalHours>24,mark as late.

                    {

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Blue;

                    }

                }

            }

     

     

    The code is almost the same with you except some differences. When I sort the DueDate column, no matter ascend or descend, the rows were always marked correctly. Please have a try with the above code and see whether the problem still exists.

     

    Best Regards,

    Bruce Zhou

     

    Windows Forms General FAQs
    Windows Forms Data Controls and Databinding FAQs

     

    Wednesday, August 27, 2008 9:47 AM
  • Hi Bruce,

     

    Thanks for taking the time to reply to me.  I used your cellformatting event code but I still have the same problem.  Could you try your sample with only one task that is very late.  Have the other entries with null due dates.  Everything is fine until I sort by due date column desc.  All rows are then coloured as very late (the one very late row is at the top).  My first post wasn't that clear, the rows are all coloured as very late but only one of them is very late (not late as my original post said), but all the same they are incorrectly coloured.

     

    I am using .net 2 and developing under VS 2008 if that makes a difference.

     

    Thanks,

    CB

     

    Wednesday, August 27, 2008 6:47 PM
  • Hi chinnybloke,

    Thanks for your clarification. I know the problem better now.

    Originally, my project was targeting .NET 3.5 Framework under Visual Studio 2008. Now in order to exclude the possibility that different environment may bring in, I made the environment the same with you.

    As you said, I made only one of the six tasks very late and the DueDate column of left tasks are all “NULL”, the result, which is as expected, is still ok when I sort the DueDate column descend. If it is possible for you to give me a sample which can reproduce the problem, it will help me better to find the cause.

    Please also have a check about other codes which may possiable affect codes in CellFormating event handler.

    Best Regards,

    Bruce Zhou

     

    Windows Forms General FAQs
    Windows Forms Data Controls and Databinding FAQs

     

    Thursday, August 28, 2008 2:05 AM
  •  

    Hi Bruce,

     

    I stripped it all out into a new project and at first it worked as you said.  Then I added my method, SetupForm(), which does some formatting on the grid.  It seems that this is the cause of the problem, but I still don't see which bit is the problem, the code is below:

     

    Thanks,

    CB

     

     

    Code Snippet

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Data.SqlClient;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace CellFormatting

    {

    public partial class Form1 : Form

    {

    private static string m_strSQLConnection = "**************";

    private SqlDataAdapter m_dapTasks = new SqlDataAdapter("select * from Task", m_strSQLConnection);

    public Form1()

    {

    InitializeComponent();

    SetupForm();

    DataSet dsTasks = new DataSet();

    m_dapTasks.Fill(dsTasks);

    this.dataGridView1.DataSource = dsTasks.Tables[0];

    this.dataGridView1.CellFormatting +=new DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);

    }

    private bool SetupForm()

    {

    try

    {

    this.dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);

     

    //***************************************************************************

    // Now setup the grids

    //***************************************************************************

    // Define the header cell style

    DataGridViewCellStyle dgvcHeaderStyle = new DataGridViewCellStyle();

    Font fntHeader = new Font("Verdana", 9, FontStyle.Regular);

    dgvcHeaderStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;

    dgvcHeaderStyle.BackColor = Color.Navy;

    dgvcHeaderStyle.Font = fntHeader;

    dgvcHeaderStyle.ForeColor = Color.White;

    DataGridViewCellStyle dgvcDateCellStyle = new DataGridViewCellStyle();

    dgvcDateCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;

    dgvcDateCellStyle.Format = "d";

    DataGridViewCellStyle dgvcCellStyle = new DataGridViewCellStyle();

    dgvcCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;

    dgvcCellStyle.WrapMode = DataGridViewTriState.True;

    dgvcCellStyle.Padding = new Padding(2);

    Font fntCells = new Font("Verdana", 8, FontStyle.Regular);

    dgvcCellStyle.Font = fntCells;

    // *******************************************************************

    // Now set up the created by me grid

    // *******************************************************************

    dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender;

    dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None;

    dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;

    dataGridView1.ColumnHeadersDefaultCellStyle = dgvcHeaderStyle;

    dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;

    dataGridView1.ColumnHeadersHeight = dataGridView1.ColumnHeadersHeight + 5;

    dataGridView1.ScrollBars = ScrollBars.Vertical;

    dataGridView1.EnableHeadersVisualStyles = false;

    dataGridView1.MultiSelect = false;

    dataGridView1.RowsDefaultCellStyle.BackColor = Color.White;

    dataGridView1.RowHeadersVisible = false;

    dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

    dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;

    dataGridView1.DefaultCellStyle = dgvcCellStyle;

    // Now sort the column formating out

    // I've removed the code here to hide columns, format the header text, set column width etc

    return true;

    }

    catch (Exception ex)

    {

    MessageBox.Show(ex.ToString());

    return false;

    }

    }

    private void dataGridView1_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)

    {

    try

    {

    if ((this.dataGridView1.Columns[e.ColumnIndex].Name == "Due_Date") && (e.Value != null) && (e.Value != DBNull.Value))

    {

    System.Diagnostics.Debug.WriteLine("Value is _" + e.Value + "_");

    TimeSpan tsDiff = DateTime.Now.Subtract((DateTime)e.Value);

    if ((tsDiff.TotalHours > 48))

    {

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Firebrick;

    //e.CellStyle.ForeColor = Color.White;

    //e.CellStyle.BackColor = Properties.Settings.Default.VeryLateColour;

    }

    else if ((tsDiff.TotalHours > 24))

    {

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;

    //e.CellStyle.ForeColor = Color.White;

    //e.CellStyle.BackColor = Properties.Settings.Default.LateColour;

    }

    }

    }

    catch (Exception ex)

    {

    }

    }

    }

    }

     

     

    Thursday, August 28, 2008 12:58 PM
  • Hi chinnybloke,

    I can see the CellFormatingEvent was attached twice to the method. Surely, the handler method will be called twice when CellFormating event occurred. If it is not the problem, please try to comment the codes in setup method as possible until the application runs normal again, then the range of the problem will shrink and shrink, and finally come with the actual error cause.

    Best Regards,

    Bruce Zhou

     

    Windows Forms General FAQs
    Windows Forms Data Controls and Databinding FAQs

     

     

    Thursday, August 28, 2008 1:33 PM
  • Hi Bruce,

     

    The handler being added twice was just a slopy mistake when I moved it to the new project.  That is not the cause.  I have found the cause of the problem though.  In SetupForm if the following line is executed, it exhibits the problem.  With this commented out, it works.  I don't see what is wrong with that though, I want the rows to autosize to show all full text description of the task and not have a really wide column to fit it in.

     

    Thanks,

    CB

     

    Code Snippet

    dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;

     

     

    Thursday, August 28, 2008 1:58 PM
  • Hi chinnybloke,

     

    I haven't found any problem with dataGridView1.AutoSizeRowsMode property. The following codes must be executed when we sort the "Due_Date" column, since every row was maked as very late after sorting descend.

    Code Snippet

                if (dataGridView1.Columns[e.ColumnIndex].Name == "DueDate" && e.Value!=null && e.Value!=DBNull.Value)

                {

                    TimeSpan ts = DateTime.Now.Subtract((DateTime)e.Value);

                    if (ts.TotalHours > 48)//if ts.TotalHours>48, mark as very late.

                    {//(insert a breakpoint here)

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor=Color.White;

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;

                    }

     

     

    Please insert a breakpoint, and debug, see when Due_Date is DBValue.NULL, what is the value of ts.TotalHours. Since we know that if the value of "Due_Column" is DBValue.Null, this path can't be reached to.
    Thursday, August 28, 2008 3:31 PM
  •  

    Hi Bruce,  this is driving me crazy, the formatting code is not executed for anything but the due_date column where the value is non-null.  I have added break points and stepped through.  I have now stripped down my example and I find it is only going wrong when

     

    Code Snippet

    dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;

     

     

    is included.  The full stripped down code (not even querying SQL now) is below.  I can replicate it all the time using this code.

     

     

    Code Snippet

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Data.SqlClient;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace CellFormatting

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    SetupForm();

    DataSet dsTasks = new DataSet();

    DataTable dtTask = new DataTable("task");

    dtTask.Columns.Add("task_id", System.Type.GetType("System.Int16"));

    dtTask.Columns.Add("task_name", System.Type.GetType("System.String"));

    dtTask.Columns.Add("due_date", System.Type.GetType("System.DateTime"));

    dtTask.Columns["due_date"].AllowDBNull = true;

    DataRow drw = dtTask.NewRow();

    drw[0] = 1;

    drw[1] = "this is the first task";

    drw[2] = DBNull.Value;

    dtTask.Rows.Add(drw);

    drw = dtTask.NewRow();

    drw[0] = 2;

    drw[1] = "this is the second task, add some long text to make it wrap blah blah blah blah";

    drw[2] = DBNull.Value;

    dtTask.Rows.Add(drw);

    drw = dtTask.NewRow();

    drw[0] = 3;

    drw[1] = "this is the third task";

    drw[2] = DateTime.Now.AddDays(-7);

    dtTask.Rows.Add(drw);

    dsTasks.Tables.Add(dtTask);

    //m_dapTasks.Fill(dsTasks);

    this.dataGridView1.DataSource = dsTasks.Tables[0];

    }

    private void SetupForm()

    {

    try

    {

    this.dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);

    dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;

    }

    catch (Exception ex)

    {

    MessageBox.Show(ex.ToString());

    }

    }

    private void dataGridView1_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)

    {

    try

    {

    if ((this.dataGridView1.Columns[e.ColumnIndex].Name == "due_date") && (e.Value != null) && (e.Value != DBNull.Value))

    {

    System.Diagnostics.Debug.WriteLine("Value is _" + e.Value + "_");

    TimeSpan tsDiff = DateTime.Now.Subtract((DateTime)e.Value);

    if ((tsDiff.TotalHours > 48))

    {

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Firebrick;

    }

    else if ((tsDiff.TotalHours > 24))

    {

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

    dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;

    }

    }

    }

    catch (Exception ex)

    {

    }

    }

    }

    }

     

     

    Thursday, August 28, 2008 4:53 PM
  • Hi Chinnybloke,

    It’s really great you’ve found the problem. I’m sure you’ve taken great effort in finding the cause. Now I can also reproduce the problem when I set AutoSizeRowsMode to DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders. After half days’ debugging, I found regularity that all the rows were colored with the color of first row when we sort descend. Therefore, I worked out by changing the color back with the following code. It works well in my side.

    Code Snippet

            void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

            {

                if (dataGridView1.Columns[e.ColumnIndex].Name == "DueDate" && e.Value != null)

                {

                    if (e.Value != DBNull.Value)

                    {

                        TimeSpan ts = DateTime.Now.Subtract((DateTime)e.Value);

                        if (ts.TotalHours > 48)//if ts.TotalHours>48, mark as very late.

                        {

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;

                        }

                        else if (ts.TotalHours > 24)//if ts.TotalHours>24,mark as late.

                        {

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                            this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Blue;

                        }

                    }

                        /* Newly added branch */

                    else

                    {

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.White;

                        this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = SystemColors.Window;

                    }

                }

     

            }

     

    I hope the code can help you get out of frustrating. Looking for your testing result.

    Best Regards,

    Bruce Zhou

     

    Windows Forms General FAQs
    Windows Forms Data Controls and Databinding FAQs

     

    Friday, August 29, 2008 5:20 AM
  •  

    Excellent Bruce.  Many thanks.  I modified your solution ever so slightly as this overwrites all row background colors to white.  My alternate row back color should be lavender so I used:

     

    Code Snippet

     

    if (e.RowIndex % 2 == 0)

    this.dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;

    else

    this.dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Lavender;

     

    this.dataGridViewCreatedByMe.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Black;

     

     

     

     

    Surely this is bug?  It shouldn't be this much of a pain to format cells, should it??

     

    Thanks, again

    CB

    Saturday, August 30, 2008 2:29 AM
  • Glad that my code helps you. I guess it may have some conflict with AutoSizeMode. However, that’s not the key point. Congratulate  for your success.

    Best Regards,

    Bruce Zhou

     

    Windows Forms General FAQs
    Windows Forms Data Controls and Databinding FAQs

     

    Saturday, August 30, 2008 2:26 PM