Solved

Disallowing insert and delete of rows in a winforms datagrid

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

18 Experts available now in Live!

Get 1:1 Help Now