You can use SQL aliases on your sql query.
e.g :

select Name as '1', City as '2' from Address

Edited 4 Years Ago by Jx_Man: n/a

Thks, but my problem here is that I can't change DataGrid RowHeader to auto-generated numbers by VB.Net code, not by SQL. Any options?

Private Sub datagridview1_RowPostPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles grid1.RowPostPaint
        Dim strRowNumber As String = (e.RowIndex + 1).ToString
        Dim size As SizeF = e.Graphics.MeasureString(strRowNumber, Me.Font)
        If grid1.RowHeadersWidth < CInt((size.Width + 20)) Then
            grid1.RowHeadersWidth = CInt((size.Width + 20))

        End If

        Dim b As Brush = SystemBrushes.ControlText
        e.Graphics.DrawString(strRowNumber, Me.Font, b, e.RowBounds.Location.X + 15, _
                              e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) _
                                                       / 2))
    End Sub

Edited 4 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

This question has already been answered. Start a new discussion instead.