以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于已有数据或新增数据的替换问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132822)

--  作者:ZJZK2018
--  发布时间:2019/3/30 16:33:00
--  关于已有数据或新增数据的替换问题
我的需求是对已有数据或新增数据的进行替换,下面这段代码最好写哪里?

        \'\'===============除nms以外字符列新值中删除空格===============
        If e.DataCol.IsString Then
            Dim nms() As String = {"主要特征信息_工程概况","备注"}
            If Array.Indexof(nms, e.DataCol.Name) < 0 AndAlso e.NewValue > "" Then
                e.NewValue = Cstr(e.NewValue).Replace(" ","").Replace("(","(").Replace(")",")").Replace(",",",")
            End If
        End If

写在DrawCell事件只对显示改变,正真数据库里面没有改变。

--  作者:有点蓝
--  发布时间:2019/3/30 16:47:00
--  
datacolchanging事件
--  作者:ZJZK2018
--  发布时间:2019/4/16 15:43:00
--  
我在datacolchanging事件

If e.DataCol.IsString Then
    If e.DataCol.Name = "第二列"
        e.NewValue = StrToNarrow(Cstr(e.NewValue))
    End If
End If

主要是想转换为半角标点符号,但标点符号中的“句号”变成“?”,如何处理?

[此贴子已经被作者于2019/4/16 15:44:09编辑过]

--  作者:有点甜
--  发布时间:2019/4/16 16:55:00
--  

试试

 

If e.DataCol.IsString Then
    If e.DataCol.Name = "第二列" AndAlso e.newvalue <> Nothing Then
        e.NewValue = StrToNarrow(Cstr(e.NewValue).Replace(chr(-24157), "."))
    End If
End If