Solved

Stop Datagrid allowing new Rows

Posted on 2004-08-20
3
182 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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