PC Review


Reply
Thread Tools Rate Thread

DataGrid issues

 
 
Mark
Guest
Posts: n/a
 
      7th Sep 2003
Hi,

I am using a datagrid on windows form. What I want is that it should allow editing of certain columns but should not allow adding new rows. I have added a table style and the columns to the table style collection but I still get a last row with * allowing the users to add new record.

If I turn the grid into readonly then the user cant modify the columns. Is there any way to block adding new rows or to get rid of the last row with *?

Mark

 
Reply With Quote
 
 
 
 
Jeff Brown
Guest
Posts: n/a
 
      7th Sep 2003
Found a solution at http://www.dotnet247.com/247referenc.../15/77606.aspx

I think if you will declare an integer and count the rows and substitute
your intger variable where "10" is located.

There is 10 rows in my Data Grid.
When user tries to go to new row (the asterisk row), 11th row, re-position
the cell to the last row (10th row).

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles DataGrid1.CurrentCellChanged

If (DataGrid1.CurrentCell.RowNumber > 10) Then
DataGrid1.CurrentCell = New DataGridCell(10,
DataGrid1.CurrentCell.ColumnNumber) ' Re-position back to 10th row
End If

End Sub

"Allan Wong" <(E-Mail Removed)> wrote in message
news:ODKQ3QG3BHA.1940@tkmsftngp05...
[Original message clipped]

"Mark" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Hi,

I am using a datagrid on windows form. What I want is that it should allow
editing of certain columns but should not allow adding new rows. I have
added a table style and the columns to the table style collection but I
still get a last row with * allowing the users to add new record.

If I turn the grid into readonly then the user cant modify the columns. Is
there any way to block adding new rows or to get rid of the last row with *?

Mark


 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      7th Sep 2003
Thanks Jeff.

Your link was very useful and I found the way to disable the new rows by
setting the AllowNew property of the DataView to false.

Regards,

Mark



"Jeff Brown" <(E-Mail Removed)> wrote in message
news:0rL6b.7261$(E-Mail Removed)...
> Found a solution at

http://www.dotnet247.com/247referenc.../15/77606.aspx
>
> I think if you will declare an integer and count the rows and substitute
> your intger variable where "10" is located.
>
> There is 10 rows in my Data Grid.
> When user tries to go to new row (the asterisk row), 11th row, re-position
> the cell to the last row (10th row).
>
> Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e
> As System.EventArgs) Handles DataGrid1.CurrentCellChanged
>
> If (DataGrid1.CurrentCell.RowNumber > 10) Then
> DataGrid1.CurrentCell = New DataGridCell(10,
> DataGrid1.CurrentCell.ColumnNumber) ' Re-position back to 10th row
> End If
>
> End Sub
>
> "Allan Wong" <(E-Mail Removed)> wrote in message
> news:ODKQ3QG3BHA.1940@tkmsftngp05...
> [Original message clipped]
>
> "Mark" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> Hi,
>
> I am using a datagrid on windows form. What I want is that it should allow
> editing of certain columns but should not allow adding new rows. I have
> added a table style and the columns to the table style collection but I
> still get a last row with * allowing the users to add new record.
>
> If I turn the grid into readonly then the user cant modify the columns. Is
> there any way to block adding new rows or to get rid of the last row with

*?
>
> Mark
>
>



 
Reply With Quote
 
Ken Tucker
Guest
Posts: n/a
 
      7th Sep 2003
Hi,

Try binding to a dataview instead. The dataview has allownew, allowdelete, and allowedit properties.

Ken
--------------------
"Mark" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi,

I am using a datagrid on windows form. What I want is that it should allow editing of certain columns but should not allow adding new rows. I have added a table style and the columns to the table style collection but I still get a last row with * allowing the users to add new record.

If I turn the grid into readonly then the user cant modify the columns. Is there any way to block adding new rows or to get rid of the last row with *?

Mark

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid Issues Steven Clark Microsoft Dot NET Compact Framework 5 13th Jun 2008 12:31 AM
Issues with DataGrid sort =?Utf-8?B?UGF0cmljaw==?= Microsoft ADO .NET 2 26th May 2005 04:10 AM
Re: Datagrid Issues ClayB [Syncfusion] Microsoft Dot NET Framework Forms 0 28th Jul 2004 12:28 AM
DataGrid Issues =?Utf-8?B?RWxlbmFS?= Microsoft VB .NET 4 26th May 2004 12:56 AM
Datagrid Issues Megan Microsoft Dot NET Framework Forms 3 23rd Apr 2004 06:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:03 AM.