473,836 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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).Po sitionChanged, AddressOf
ArticleList_Pos itionChanged

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

Public Sub ArticleList_Pos itionChanged(By Val sender As Object, ByVal e As
System.EventArg s)

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 3464
fixed it....

Table.DefaultVi ew.AllowNew = False

Have fun/
Lars

"Lars Netzel" <ui****@adf.s e> wrote in message
news:OJ******** ******@TK2MSFTN GP02.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).Po sitionChanged, AddressOf
ArticleList_Pos itionChanged

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

Public Sub ArticleList_Pos itionChanged(By Val sender As Object, ByVal e As
System.EventArg s)

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).Po sitionChanged, AddressOf
ArticleList_Pos itionChanged

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

Public Sub ArticleList_Pos itionChanged(By Val sender As Object, ByVal e As
System.EventArg s)

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
3932
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 addition fields. I'm able to get the datagrid to be properly populate with only the child records relating to the specified parent by setting the ..DefaultView.RowFilter property. Currently, to properly add a new child record, I need to manually...
5
4745
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 DataGrid. Anyone know how to do this on derived classes? I find it apalling that Microsoft provided a DataGrid that is so inflexible! -- Dennis in Houston
10
8143
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 to have a fixed number of rows regardless of what data is in the bound table? Thanks, Aaron -- --- Aaron Smith
2
11130
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 in advance.
3
1501
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
1230
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 Remove Button So these all controls are in 1 row and looks like:
1
1513
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 only a couple of rows and the height is far less than 400px, there is a large space to the next item on the page. Does anyone know how I can reduce this gap until the datagrid height of 400px is reached?
1
1669
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 rows returned by the data source is exceeding 10K rows. It is taking several minutes for the grid to populate and display - the users think the app is hung. Is anyone aware of a limitation of the number of rows in the GridView control? -Bob
7
13446
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 'unbound' datagrid control view on a form and just want to be able to write text to individual cells. I can programatically set the number of rows and cells, but have been unable to select and/or write to cells.
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9671
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10255
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9382
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7793
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6980
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4459
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4021
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.