以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  TrimStart和Replace为什么不起作用  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=162234)

--  作者:tongke
--  发布时间:2021/4/9 17:01:00
--  TrimStart和Replace为什么不起作用
Dim tb As Table = e.Form.Controls("tblDtl").Table
Dim ziduan As String
ziduan = ""
For Each c As Col In tb.Cols
    ziduan = ziduan & "," & c.Name
Next
ziduan.TrimStart(",")
ziduan.Replace("应付工资","")
Dim tx As WinForm.TextBox = e.Form.Controls("TextBox1")
tx.Text = ziduan
想得到表的所有字段名称,然后去掉不需要的字符,但是运行代码后得到的字符串“ziduan”中第一个逗号和“应付工资”几个字都没有去掉

--  作者:有点蓝
--  发布时间:2021/4/9 17:06:00
--  
For Each c As Col In tb.Cols
    ziduan = ziduan & "," & c.Name
Next
ziduan = ziduan.TrimStart(",")
ziduan = ziduan.Replace("应付工资","")
[此贴子已经被作者于2021/4/9 17:06:20编辑过]