S
Steve Richter
I set the Text of a DataGridView control expecting this text to be
displayed at the top of the control, as the grid title. But the text
does not display. How do I display title text above the column
heading of a DataGridView?
thanks,
DataGridView mGrid1 ;
mGrid1 = new DataGridView();
mGrid1.Parent = this;
mGrid1.AutoSize = true;
mGrid1.Dock = DockStyle.Fill;
mGrid1.ColumnCount = 0;
mGrid1.AutoGenerateColumns = false;
mGrid1.ColumnHeadersVisible = true;
mGrid1.RowHeadersVisible = false;
mGrid1.AllowUserToAddRows = false;
mGrid1.Text = "Finance Disbursements - 2007";
Grid_AddColumns(mGrid1);
private void Grid_AddColumns(DataGridView InGrid)
{
DataGridViewTextBoxCell tbCell = new DataGridViewTextBoxCell();
DataGridViewColumn tbCol = new DataGridViewColumn();
tbCol.Name = "CheckNbr";
tbCol.HeaderText = "Check number";
tbCol.CellTemplate = tbCell;
tbCol.Width = this.Font.Height * 12;
InGrid.Columns.Add(tbCol);
tbCell = new DataGridViewTextBoxCell();
tbCol = new DataGridViewColumn();
tbCol.Name = "CheckDate";
tbCol.HeaderText = "Check date";
tbCol.CellTemplate = tbCell;
tbCol.Width = this.Font.Height * 15;
InGrid.Columns.Add(tbCol);
tbCell = new DataGridViewTextBoxCell();
tbCol = new DataGridViewColumn();
tbCol.Name = "CheckAmt";
tbCol.HeaderText = "Check amount";
tbCol.CellTemplate = tbCell;
tbCol.Width = this.Font.Height * 15;
InGrid.Columns.Add(tbCol);
}
displayed at the top of the control, as the grid title. But the text
does not display. How do I display title text above the column
heading of a DataGridView?
thanks,
DataGridView mGrid1 ;
mGrid1 = new DataGridView();
mGrid1.Parent = this;
mGrid1.AutoSize = true;
mGrid1.Dock = DockStyle.Fill;
mGrid1.ColumnCount = 0;
mGrid1.AutoGenerateColumns = false;
mGrid1.ColumnHeadersVisible = true;
mGrid1.RowHeadersVisible = false;
mGrid1.AllowUserToAddRows = false;
mGrid1.Text = "Finance Disbursements - 2007";
Grid_AddColumns(mGrid1);
private void Grid_AddColumns(DataGridView InGrid)
{
DataGridViewTextBoxCell tbCell = new DataGridViewTextBoxCell();
DataGridViewColumn tbCol = new DataGridViewColumn();
tbCol.Name = "CheckNbr";
tbCol.HeaderText = "Check number";
tbCol.CellTemplate = tbCell;
tbCol.Width = this.Font.Height * 12;
InGrid.Columns.Add(tbCol);
tbCell = new DataGridViewTextBoxCell();
tbCol = new DataGridViewColumn();
tbCol.Name = "CheckDate";
tbCol.HeaderText = "Check date";
tbCol.CellTemplate = tbCell;
tbCol.Width = this.Font.Height * 15;
InGrid.Columns.Add(tbCol);
tbCell = new DataGridViewTextBoxCell();
tbCol = new DataGridViewColumn();
tbCol.Name = "CheckAmt";
tbCol.HeaderText = "Check amount";
tbCol.CellTemplate = tbCell;
tbCol.Width = this.Font.Height * 15;
InGrid.Columns.Add(tbCol);
}