title: VB.NET - how to add a title on top of printed page in datagridview?
body: <p>I have a windows application on VB.net 2010 and a datagridview inside,</p>
  
  <p>all works fine and the printing also, but I would like to add a Title on the printed page! from textbox that I have, is it possible?</p>
  
  <p>Please replay as soon as you can, and this is my PrintDocument code attached!</p>
  
  <pre><code>With DataGridView1
          Dim fmt As StringFormat = New StringFormat(StringFormatFlags.LineLimit)
          fmt.LineAlignment = StringAlignment.Center
          fmt.Trimming = StringTrimming.EllipsisCharacter
          Dim y As Single = e.MarginBounds.Top
          Do While mRow &lt; .RowCount
              Dim row As DataGridViewRow = .Rows(mRow)
              Dim x As Single = e.MarginBounds.Left
              Dim h As Single = 0
              For Each cell As DataGridViewCell In row.Cells
                  Dim rc As RectangleF = New RectangleF(x, y, cell.Size.Width, cell.Size.Height)
                  e.Graphics.DrawRectangle(Pens.Black, rc.Left, rc.Top, rc.Width, rc.Height)
                  If (newpage) Then
                      e.Graphics.DrawString(DataGridView1.Columns(cell.ColumnIndex).HeaderText, .Font, Brushes.Black, rc, fmt)
                  Else
                      e.Graphics.DrawString(DataGridView1.Rows(cell.RowIndex).Cells(cell.ColumnIndex).FormattedValue.ToString(), .Font, Brushes.Black, rc, fmt)
                  End If
                  x += rc.Width
                  h = Math.Max(h, rc.Height)
              Next
              newpage = False
              y += h
              mRow += 1
              If y + h &gt; e.MarginBounds.Bottom Then
                  e.HasMorePages = True
                  mRow -= 1
                  newpage = True
                  Exit Sub
              End If
          Loop
          mRow = 0
      End With
  </code></pre>
  
  <p>And also, can I adjust the space from the top of the page?
  Thanx in advance ^^</p>