Solved

Disallowing insert and delete of rows in a winforms datagrid

Posted on 2004-09-15
2
220 Views
Last Modified: 2010-04-23
I am using a winforms datagrid to display data from a database. I wish to allow the user to modify the existing records and save the changes, but NOT delete or insert any records.

I am currently using the grid with the ReadOnly property set to False.

This works well for the modifying of existing records, but there is still a "New Row" (displayed with a * on the left hand side) at the bottom of the grid.

Does anybody know how to remove this row from the grid and still keep the ReadOnly property set to False??

Thanks.

0
Comment
Question by:quickly_james
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 125 total points
ID: 12072367
Yes use a dataview as your datasource then you can do stuff like

dim dv as new dataview = ds.tables(0).defaultview
dv.allownew = false
dv.allowedit = true
dv.allowdelete = false

datagrid1.datasource = dv


0
 

Author Comment

by:quickly_james
ID: 12072392
Thanks Ronald!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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