我是通过前台设置的类型为gctextbox.
- Private Sub fpSpread_EditChange(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles fpSpread.EditChange
- If spdGaihan.ActiveColumnIndex = 3 Then
- fpSpread.EditModeReplace = False
- spdGaihan.Cells(spdGaihan.ActiveRowIndex, spdGaihan.ActiveColumnIndex).Text = Post_No_Edit(spdGaihan.Cells(spdGaihan.ActiveRowIndex, spdGaihan.ActiveColumnIndex).Text)
- End If
- End Sub
复制代码- Public Function Post_No_Edit(ByVal strPostNo As String) As String
- Dim strLen As Integer
- Dim intPos As Integer
- Dim strWork As String
- strLen = Len(strPostNo)
- strWork = strPostNo
- Do
- intPos = InStr(1, strWork, "-")
- If intPos = 0 Then
- Exit Do
- ElseIf intPos = 1 Then
- strWork = Mid(strWork, 2, strLen - 1)
- Else
- strWork = Mid(strWork, 1, intPos - 1) & Mid(strWork, intPos + 1, strLen)
- End If
- Loop Until intPos = 0
- strLen = Len(strWork)
- If strLen <= 3 Then
- ElseIf strLen >= 4 Then
- strWork = Mid(strWork, 1, 3) & "-" & Mid(strWork, 4, strLen - 3)
- End If
- Post_No_Edit = strWork
- End Function
复制代码 |