Hi,
Add eventhandler for event CurCellChange of the datagrid control and see if the current row value is greater thatn your data size.
If yes, then discard the change (focus back to earlier selected row/cell).
HTH,
Ashutosh
"Thejus" <th*************@hotmail.com> wrote in message news:uh**************@tk2msftngp13.phx.gbl...
Hi,
When I read from a XML Document and assign -
DataSet.ReadXml(@"C:\Abc.Xml",XmlReadMode.Auto);
DataGrid.DataSource = DataSet;
I get the DataGrid filled, but the data is not filled in the datagrid. It
shows Table Name as a link, on clicking of which the grid is filled. Even
the DataGrid.Expand(-1) do not expand the rows.
Is there any way for this?
Thanks
Thejus
"Jussi" <a.*@a.com> wrote in message news:ee**************@TK2MSFTNGP09.phx.gbl...
I load a XML document in the DataGrid:
private System.Windows.Forms.DataGrid myDataGrid = new DataGrid();
private DataSet m_myDataSet = new DataSet();
m_myDataSet.ReadXml(@"C:\...\MyDocument.xml");
myDataGrid.DataSource = m_myDataSet;
This works fine and user can edit the loaded document. The problem is that I
don't want to give possibility to change the structure of the
MyDocument.xml. User should only change data in the already existing fields.
In the DataGrid user can create for example new rows and these are saved to
the MyDocument.xml when
m_myDataSet.WriteXml(@"C:\...\MyDocument.xml");
is done and MyDocument.xml is corrupted. Is there a way to avoid this?
-JK