473,406 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Setting Limitation to number of Rows in DataGrid?

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
May 15 '06 #1
2 3439
fixed it....

Table.DefaultView.AllowNew = False

Have fun/
Lars

"Lars Netzel" <ui****@adf.se> wrote in message
news:OJ**************@TK2MSFTNGP02.phx.gbl...
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

May 15 '06 #2
Lars,

Once 10 new rows have been added you could prevent the datagrid from
displaying its Append row:

http://www.syncfusion.com/FAQ/Window...44c.aspx#q653q

Kerry Moorman
"Lars Netzel" wrote:
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

May 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
5
by: Dennis | last post by:
I have a class that inherits from DataGrid. I can set the rowheights in a DataGrid by tappig into the "get_Datagridrows" method. However, this does not work for classes that inherit from...
10
by: Aaron Smith | last post by:
If I have a datagrid and the bound data file only have 4 rows in it, the grid will show the 4 rows. However, there is blank space below that until it reaches the bottom of the grid. Is there a way...
2
by: patang | last post by:
I found the following to count the total number of VISIBLE rows of datagrid datagrid.visiblerowcount How do we count the total number of ACTUAL (not just visible) rows of datagrid? Thanks...
3
by: SDRoy | last post by:
Hi Is there a limitation on how many rows can be fetched using a SqlDataReader in ASP.Net 2.0 ? -- Thanks, SDRoy
0
by: Rocky | last post by:
Dear ALL, I am facing a bit problem in DATAGRID. so may be you guys can help me out. Actually on a DataGrid I am having following controls: 1) 2 DropDown Menu 2) 1 Text Box 3) 1 ADD Button 4)...
1
by: RateTheBuilder | last post by:
Hi I have a datagrid on my page, which has the MaximumHeight set to 400px. So when the number of rows exceeds this height, then the vertical scroll appears. My problem is that when there is...
1
by: Bob Phillips | last post by:
Hi All: I have a GridView showing the results of a simple select of a portion of customer records. It's been working well in production now for a few months. In the last few days, the number of...
7
by: bobk | last post by:
My apologies upfront for what I am sure is a newbie question, but I have been unable to find an answer via search. I am a VB6 programmer trying to write programs in VB 2008 Express. I have an...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.