?
Solved

Disallowing insert and delete of rows in a winforms datagrid

Posted on 2004-09-15
2
Medium Priority
?
222 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 500 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

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

741 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