Setting Limitation to number of Rows in DataGrid?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top