Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dataGrid (not a datagridview) with 12 rows. The last row is partially visible. When I click the last row the datagrid rows scroll up and one row is added after the last row.But what I want is that the rows should not scroll at all and there should not be any new row added to the last one ie the state of datagrid rows positions should remain the same.I have the application written in VB.Net 2010 & sql server 2008.
It would be nice of you to guide me to a solution for the problem.

What I have tried:

1. datagrid.readonly = True ;does not work
2. There no option to freeze the datagrid.
Posted
Updated 27-Jan-17 22:30pm
v5

1 solution

 
Share this answer
 
v2
Comments
Arvind61 28-Jan-17 4:48am    
Datagrid does not have this property.
Arvind61 28-Jan-17 5:29am    
Thanks for the reply. Datagrid comes from two namespaces System.Windows.controls and system.windows.forms. My datagrid comes from system.windows.forms . Hence the application cannot include from the first namespaces.There is ambiguity in datagrid.How do I resolve this.
Richard MacCutchan 28-Jan-17 5:43am    
The DataGrid has been replaced by the DataGridView, which gives you more control.
Arvind61 28-Jan-17 7:49am    
But the project is built using DataGrid
CHill60 28-Jan-17 9:15am    
Swap the existing DataGrid control in the project for a DataGridView. You may have to manually edit the code-behind when renaming the incoming control.
I suggest that you add the new control before deleting the old one and
don't forget to take a backup of the project folder first
Find the formName.Designer.vb references
Friend WithEvents DataGridName As System.Windows.Forms.DataGrid
...
Me.DataGridName = New System.Windows.Forms.DataGrid()
and change to
Friend WithEvents DataGridName As System.Windows.Forms.DataGridView
...
Me.DataGridName = New System.Windows.Forms.DataGridView()

You may also have to change code that references methods/properties of DataGrid that were not carried over to DataGridView (although I doubt it)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900