Setting Limitation to number of Rows in DataGrid?

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

Hi

I need to have a limitation for the number of rows one can add in a datagrid
(bound from a DataTable), in this case maximum should be 10 rows.

My approach I guess is to catch the rownumber in the CurrencyManager via
BindingContext.PositionChanged but how do I then stop new rows from being
created?

in FormLoad() I add a handler for the bindingcontext and a datatable called
"Articles"
AddHandler BindingContext(Me.Articles).PositionChanged, AddressOf
ArticleList_PositionChanged

----------------------------------------------

Public Sub ArticleList_PositionChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

CurrencyManager).Position + 1

If CType(sender, CurrencyManager).Count > 10 Then

'some smart code goes here?

End If

End Sub


Please Help!
/Lars Netzel
 
Back
Top