vb.net grid激活行或激活单元格的index取得方法

前端之家收集整理的这篇文章主要介绍了vb.net grid激活行或激活单元格的index取得方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

''' <summary>
'''
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub grdDetail_AfterCellUpdate(ByVal sender As System.Object,ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles grdDetail.AfterCellUpdate

Try

Select Case e.Cell.Column.Key

Case "DAY1_1","DAY2_1","DAY3_1","DAY4_1","DAY5_1","DAY6_1","DAY7_1","DAY8_1","DAY9_1","DAY10_1",_
"DAY11_1","DAY12_1","DAY13_1","DAY14_1","DAY15_1","DAY16_1","DAY17_1","DAY18_1","DAY19_1","DAY20_1",_
"DAY21_1","DAY22_1","DAY23_1","DAY24_1","DAY25_1","DAY26_1","DAY27_1","DAY28_1","DAY29_1","DAY30_1","DAY31_1"

Me.grdDetail.EventManager.AllEventsEnabled = False

'e.Cell.Row.Index: 取得激活行的index

'e.Cell.Column.Index: 取得激活cell的index

End Select

'Me.grdDetail.Rows(intRowIndex).Cells(intCellIndex).Column.ToString: 取得激活行,激活cell的列名

Dim strColumnName As String = Me.grdDetail.Rows(intRowIndex).Cells(intCellIndex).Column.ToString
Dim intCurrentIndex As Integer = CInt(strColumnName.Substring(strColumnName.IndexOf("Y") + 1,strColumnName.IndexOf("_") - strColumnName.IndexOf("Y") - 1))

'按cell的列名进行赋值

Me.grdDetail.Rows(intRowIndex).Cells("DAY" & intColIndex & "_2").Value = System.DBNull.Value

'按cell的index进行赋值

Me.grdDetail.Rows(intRowIndex).Cells(intCellIndex).value=555

'按激活的cell进行赋值

Me.grdDetail.ActiveCell.Value=555

Me.grdDetail.EventManager.AllEventsEnabled = True


Catch ex As Exception
Me.grdDetail.EventManager.AllEventsEnabled = True

If Not objDbConn Is Nothing Then
objDbConn.PSb_CloseDB()
objDbConn = Nothing
End If
Me.Cursor = Cursors.Arrow
ComException.Show(Me.FeatureCode,ex)
Finally


Me.Cursor = Cursors.Arrow


If Not objDbConn Is Nothing Then
objDbConn.PSb_CloseDB()
objDbConn = Nothing
End If

End Try End Sub

原文链接:https://www.f2er.com/vb/261125.html

猜你在找的VB相关文章