System.ComponentModel.ListSortDirection.Ascending
What I have tried: Dim i As Integer = 0 DataGridView2.Sort(DataGridView2.Columns(1), System.ComponentModel.ListSortDirection.Ascending) ReorderSrNo() For i = 0 To DataGridView2.Rows.Count - 1 ''Add Items To Physical Stock Dim SRno= DataGridView2.Rows(i).Cells(0).Value Dim ItemCode= DataGridView2.Rows(i).Cells(1).Value Next Public Sub ReorderSrNo() Dim counter As Integer = 0 For ii As Integer = 0 To DataGridView2.Rows.Count - 1 DataGridView2.Rows(ii).Cells(0).Value = (System.Math.Max(System.Threading.Interlocked.Increment(counter), counter - 1)).ToString() Next Dim no As Integer no = DataGridView2.Rows.Count End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)