Solved

Stop Datagrid allowing new Rows

Posted on 2004-08-20
3
180 Views
Last Modified: 2010-04-23
I have a datgrid with  a table as the datasource.  

I would like to prevent the datagrid from having new rows added to it but still require the user to be able to edit the contents.  (stop the star row at the bottom)

I changed the datagrid to readonly however this stops editing completely even if i change the column style property to false


eg:
        .GridColumnStyles(6).ReadOnly = False
        .GridColumnStyles(7).ReadOnly = False

Thanks

matt
0
Comment
Question by:cafferm
3 Comments
 
LVL 21

Accepted Solution

by:
tovvenki earned 200 total points
ID: 11850170
Hi,
The DataGrid class does not have a property that controls whether a new row can be added. But the DataView class does have such a property (along with some others such as AllowEdit and AllowDelete).
Dim cm As CurrencyManager
        cm = CType(Me.BindingContext(DataGrid1.DataSource, DataGrid1.DataMember), CurrencyManager)
        CType(cm.List, DataView).AllowNew = False
        CType(cm.List, DataView).AllowEdit = True

Regards,
venki
 
 
0
 

Author Comment

by:cafferm
ID: 11862608
i don't know how it works by by jo it works

thanks very much!!!

Matt
0
 
LVL 1

Expert Comment

by:geedub1961
ID: 13992251
Does this work even if not on a dataview?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now