以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 字符串提取 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=67036) |
-- 作者:一笑 -- 发布时间:2015/4/17 22:00:00 -- 字符串提取 提取航班号列的值的字符到“号1”和“号2”列中,输入航班列后运行正常,但如重置“航班号”列则会出现: If e.DataCol.Name = "航班号" Then \'Dim fdr As DataRow Dim dr As DataRow = e.DataRow Dim s As String = dr("航班号") If dr("航班号") Is Nothing Then dr("号1") = Nothing dr("号2") = Nothing Else dr("号1") = s.Chars(0) dr("号2") = s.Chars(1) End If End If 请问原因,谢谢
|
-- 作者:有点酸 -- 发布时间:2015/4/17 22:06:00 -- If e.DataCol.Name = "航班号" Then Dim dr As DataRow = e.DataRow Dim s As String = dr("航班号").Trim If s = "" dr("号1") = Nothing dr("号2") = Nothing Else dr("号1") = s.Chars(0) dr("号2") = s.Chars(1) End If End If |
-- 作者:程兴刚 -- 发布时间:2015/4/17 22:18:00 -- If e.DataCol.Name = "航班号" Then Dim dr As DataRow = e.DataRow Dim s As String If dr.isnull("航班号") = False s = "*" & dr("航班号") Else s = "**********" End If For i As Integer = 1 To 6 dr("号" & i) = s.SubString(i,1).Replace("*","") Next End If |