Solved

Disallowing insert and delete of rows in a winforms datagrid

Posted on 2004-09-15
2
218 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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 …
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 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 …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

815 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

11 Experts available now in Live!

Get 1:1 Help Now