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..."
}