format函数似乎只对数字、日期有效,对文本不起作用,我觉得自己写个函数处理比较方便,如下:
private function StrFmt(ExtPr as string,sLen as integer,Align as boolean) as string
dim a as string
a=left(extpr,slen)
if align then
StrFmt=a & space(slen-len(a))
'左对齐
else
StrFmt=space(slen-len(a)) & a
'右对齐
endif
end function
调用方法
list1.additem
StrFmt("序号",8,true) & StrFmt("点数",8,true) & StrFmt("误差",8,true)