Add Rows Number to DataGridView

Tháng Chín 12, 2008 at 1:04 sáng Để lại phản hồi

Private Sub ExDataGrid1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles ExDataGrid1.CellPainting
Dim sf As New StringFormat
sf.Alignment = StringAlignment.Center

If e.ColumnIndex < 0 AndAlso e.RowIndex >= 0 AndAlso e.RowIndex < ExDataGrid1.Rows.Count – 1 Then
e.PaintBackground(e.ClipBounds, True)
e.Graphics.DrawString((e.RowIndex + 1).ToString, Me.Font, Brushes.Black, e.CellBounds, sf)
e.Handled = True
End If

End Sub

Entry filed under: VB.NET. Tags: .

Save DataGridView to Text file,CSV file Thread in VB NET 2005

Gửi phản hồi

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Thay đổi )

Twitter picture

You are commenting using your Twitter account. Log Out / Thay đổi )

Facebook photo

You are commenting using your Facebook account. Log Out / Thay đổi )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


 

Tháng Chín 2008
T2 T3 T4 T5 T6 T7 CN
« Tháng 8   Tháng 10 »
1234567
891011121314
15161718192021
22232425262728
2930  

Follow

Get every new post delivered to your Inbox.