Public Function AddNewRowInRange() As DataRow
If DataSource IsNot Nothing AndAlso TypeOf (DataSource) Is DataTable Then
Dim dt As DataTable = DirectCast(DataSource, DataTable)
Dim dr As DataRow = dt.NewRow
Dim currentRowIndex As Integer = Me.RowCount
dt.Rows.InsertAt(dr, currentRowIndex)
Me.Focus()
Return dr
End If
Return Nothing
End Function |