Solved

Stop Datagrid allowing new Rows

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

12 Experts available now in Live!

Get 1:1 Help Now