newtome Posted December 17, 2003 Posted December 17, 2003 Can anyone help. I am having difficulty protecting just an individual cell on a data grid. Since it is column oriented, all I can seem to do is protect the entire colume. Thanks Quote
Moderators Robby Posted December 17, 2003 Moderators Posted December 17, 2003 If this protection is based on the data contained in that cell, you can trap the selectedIndeChanged event, then determine its' contents then discard or disaloow changes at that point. As far as I know you can't do this during render/bind. Quote Visit...Bassic Software
Mohsen Posted December 18, 2003 Posted December 18, 2003 if you want to validate the data inside the column then the validation will apply to all the column, else do the following, use the yourdatagrid_MouseDown event, and write the following inside: Dim hti As DataGrid.HitTestInfo = yourdatagrid.HitTest(e.X, e.Y) If hti.Row <= yourdatagrid.DataSource.rows.count - 1 Then If hti.Row = the_index_of_the_row_you_want Then If hti.Type = Windows.Forms.DataGrid.HitTestType.Cell Then If hti.Column = your_column Then msbBox("You can't access"); End If End If End If End If Mohsen Quote
newtome Posted December 18, 2003 Author Posted December 18, 2003 Actually the protection is based on the data contained in the previous cell as to whether or not they have access to the next cell or not. Depending upon the actual type of information entered into the previous cell, I then need to determine whether or not to gray out and protect the following cell. I will try the ideas that you have given me so far. If you have a better solution based on this additional information, please let me know. Thanks Quote
Mohsen Posted December 19, 2003 Posted December 19, 2003 I have another way to lock a cell only, but it needs a class that we have here at the company where I work. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.