禁用/启用datagridview中的指定行 [英] disable/enabled the specified row in datagridview
本文介绍了禁用/启用datagridview中的指定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在datagridview中有一些行。
如何在datagridview中禁用/启用指定的行???
请任意帮助我......
谢谢
解决方案
无法使用datagridview对象禁用特定行。
但还有其他选项,例如更改所需行的格式以使其看起来像禁用:
私有 Sub ConfigDisabled( Byval RowNumber as integer )
Dim CelaActiva 作为 新 DataGridViewCellStyle
CelaActiva.BackColor = Color.White
CelaActiva.Alignment = DataGridViewContentAlignment.MiddleCenter
CelaActiva.SelectionBackColor = Co lor.White
CelaActiva.SelectionForeColor = Color.Gray
CelaActiva.ForeColor = Color.Gray
Datagridview1.Rows(RowNumber).DefaultCellStyle = CelaActiva
Datagridview1.Rows (RowNumber)。 ReadOnly = True
End Sub
希望这可以帮到你;)
I have some rows in datagridview.
How can i disable/enabled the specified row in datagridview???
Please any help me......
Thanks
解决方案
There's no way to disable an specific row using the datagridview object.
But there was another options, like changing the format of the row you want in order to make this seems like disabled:
Private Sub ConfigDisabled(Byval RowNumber as integer) Dim CelaActiva As New DataGridViewCellStyle CelaActiva.BackColor = Color.White CelaActiva.Alignment = DataGridViewContentAlignment.MiddleCenter CelaActiva.SelectionBackColor = Color.White CelaActiva.SelectionForeColor = Color.Gray CelaActiva.ForeColor = Color.Gray Datagridview1.Rows(RowNumber).DefaultCellStyle = CelaActiva Datagridview1.Rows(RowNumber).ReadOnly = True End Sub
Hope this helps you ;)
这篇关于禁用/启用datagridview中的指定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文