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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:55:37+00:00 2026-06-10T09:55:37+00:00

When I populate selected cells in my DataGridView with values, such as 1, rather

  • 0

When I populate selected cells in my DataGridView with values, such as “1”, rather than simply displaying “1” they display “1…”

Why would that be the case, and how can I prevent the ellipsis dots from displaying?

UPDATE

Here’s the requested code (below). A scream shot of what it looks like is at (on hold, for some reason posterous is not accepting it as either a dot bump or a jay peg).

Anyway, the DGV looks something like this:

00:00 | 1...
00:15 | 
00:30 | 1...
00:45 | 1...

…when it should be:

00:00 | 1
00:15 | 
00:30 | 1
00:45 | 1

As noted in the comment on the last line, the phone value is simply “1” with the tested data. Hovering over that value shows a tooltip/hint of “1” (not “1…” or some such).

private void CreateAndPopulateDGVPlatypusScheduleCells()
{
    // Add the needed columns
    if (dataGridViewPlatypusSchedule.Columns.Count == 0) {
        for (int i = 0; i < PLATYPUS_SCHEDULE_COL_COUNT; i++) {
            string colName = string.Format("Column{0}", i + 1);
            dataGridViewPlatypusSchedule.Columns.Add(colName, colName);
            dataGridViewPlatypusSchedule.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            dataGridViewPlatypusSchedule.Columns[i].Resizable = DataGridViewTriState.False;

            DataGridViewCell cell = new DataGridViewTextBoxCell();
            if (i % 4 == 0) {
                cell.Style.BackColor = Color.Bisque;
                dataGridViewPlatypusSchedule.Columns[i].CellTemplate = cell;
                dataGridViewPlatypusSchedule.Columns[i].Width = 41;
                dataGridViewPlatypusSchedule.Columns[i].ReadOnly = true;
            } else {
                cell.Style.BackColor = Color.White;
                dataGridViewPlatypusSchedule.Columns[i].CellTemplate = cell;
                dataGridViewPlatypusSchedule.Columns[i].Width = 13;
                dataGridViewPlatypusSchedule.Columns[i].ReadOnly = false;
            }
        }
    }

    // Add the needed rows
    if (dataGridViewPlatypusSchedule.Rows.Count == 0)
    {
        for (int row = 0; row < PlatypusScheduleGridRowCount; row++) {
            // Save each row as an array
            string[] currentRowContents = new string[PLATYPUS_SCHEDULE_COL_COUNT];
            // Add each column to the currentColumn
            for (int col = 0; col < PLATYPUS_SCHEDULE_COL_COUNT; col++)
            {
                currentRowContents[col] = this.GetPlatypusScheduleTimeStringForCell(row, col);
            }
            // Add the row to the DGV
            dataGridViewPlatypusSchedule.Rows.Add(currentRowContents);
        }
    }

    int dow = this.GetDOWAsInt(ActiveDow);
    listQHduckBill = InterpSchedData.GetPlatypusScheduleForFunnyMammal(platypusId, dow);
    foreach (var duckBill in listQHduckBill)
    {
        int QHCell = duckBill.QH;
        string ph1 = duckBill.PH1;
        string ph2 = duckBill.PH2;
        string ph3 = duckBill.PH3;
            if (!(string.IsNullOrWhiteSpace(ph1)))
        {
            PopulatePlatypusScheduleCell(QHCell, 1, ph1);
        }
        if (!(string.IsNullOrWhiteSpace(ph2))) {
            PopulatePlatypusScheduleCell(QHCell, 2, ph2);
        }
        if (!(string.IsNullOrWhiteSpace(ph3))) {
            PopulatePlatypusScheduleCell(QHCell, 3, ph3);
        }
    }
}

private void PopulatePlatypusScheduleCell(int cellToPopulate, int offset, string phoneVal)
{
    int timeColumnBase = (cellToPopulate / PLATYPUS_SCHEDULE_COL_COUNT);
    string colName = this.GetColumnToPopulate(timeColumnBase, offset);
    int rowToPopulate = GetRowToPopulate(cellToPopulate);
    DataGridViewRow dgvr = dataGridViewPlatypusSchedule.Rows[rowToPopulate];
    dgvr.Cells[colName].Value = phoneVal; // <- This (phoneVal) is "1" but displays as "1..."
}
  • 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-10T09:55:38+00:00Added an answer on June 10, 2026 at 9:55 am

    I used the msdn code referenced by , but incorporated the StringFormat object and replaced the garish crimson and blue with black (for the content font) and blanchedalmond, to blend in with my grid. The three things I changed from the msdn code are noted/commented:

    private void dataGridViewLifeSchedule_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) {
        // 1. This is used to replace what is StringFormat.GenericDefault in the msdn code with strFormat
        StringFormat strFormat = new StringFormat();
        strFormat.Trimming = StringTrimming.None; 
    
        Rectangle newRect = new Rectangle(e.CellBounds.X + 1,
        e.CellBounds.Y + 1, e.CellBounds.Width - 4,
        e.CellBounds.Height - 4);
    
        using (
            Brush gridBrush = new SolidBrush(this.dataGridViewLifeSchedule.GridColor),
            backColorBrush = new SolidBrush(e.CellStyle.BackColor)) {
            using (Pen gridLinePen = new Pen(gridBrush)) {
                // Erase the cell.
                e.Graphics.FillRectangle(backColorBrush, e.CellBounds);
    
                // Draw the grid lines (only the right and bottom lines; 
                // DataGridView takes care of the others).
                e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
                    e.CellBounds.Bottom - 1, e.CellBounds.Right - 1,
                    e.CellBounds.Bottom - 1);
                e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
                    e.CellBounds.Top, e.CellBounds.Right - 1,
                    e.CellBounds.Bottom);
    
                // Draw the inset highlight box.
                e.Graphics.DrawRectangle(Pens.BlanchedAlmond, newRect); // 2. It is Pens.Blue in the msdn code
    
                // Draw the text content of the cell, ignoring alignment. 
                if (e.Value != null) {
                    e.Graphics.DrawString((String)e.Value, e.CellStyle.Font,
                        Brushes.Black, e.CellBounds.X + 2, // 3. It is Brushes.Crimson in the msdn code
                        e.CellBounds.Y + 2, strFormat);
                }
                e.Handled = true;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the selected option from a dropdown and populate another
I'm creating a javascript method that populates lists depending on a radio button selected
I am trying to populate a ListView ....but I cant add 2 string values
How do you populate an empty matrix with the values of another matrix? The
I have a QTableWidget that I populate like this: // Clear the table this->topPatchesTableWidget->setRowCount(0);
I have a DataGridView with two DataGridViewComboBoxColumns. I want to use the selected item
I am trying to populate a WebGrid cell with an image that will open
I'm sure you've all seen them. Line of Business UIs that have logic such
I am attempting to populate a dropdown based on the value selected in another
suppose i have one datagridview and datagridview has one DataGridViewComboBoxColumn. i have populate datagridview

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.