注册 登录
编程论坛 VB6论坛

vb保存txt保存数对齐问题

xd12345 发布于 2014-01-03 10:54, 663 次点击
Private Sub Command8_Click()
List3.AddItem Label3 & Text1
List3.AddItem Text2 & Combo2
List3.AddItem Label6 & Text32 & Label80 & Text4
List3.AddItem Label31 & "       " & Label32 & "    " & Label34 & "    " & Label33 & "    " & Label35
List3.AddItem Combo19 & "    " & Combo3 & "     " & Text7 & "      " & Text6 & "      " & Text3
List3.AddItem " ---------------------------------------   "
List3.AddItem Combo16 & "  " & Combo4 & "     " & Text12 & "      " & Text21 & "      " & Text14
List3.AddItem Text49 & Text47 & "    " & Combo10 & "     " & Text9 & "      " & Text8 & "      " & Text11
List3.AddItem Combo15 & "     " & Combo6 & "     " & Text18 & "      " & Text17 & "      " & Text15
List3.AddItem Combo14 & "    " & Combo5 & "     " & Text19 & "      " & Text20 & "      " & Text16
List3.AddItem Combo17 & "     " & Combo11 & "     " & Text10 & "      " & Text38 & "      " & Text13
List3.AddItem Combo13 & Label55 & "   " & Combo7 & "     " & Text25 & "      " & Text24 & "      " & Text22
List3.AddItem Combo12 & Label71 & "    " & Combo8 & "     " & Text26 & "      " & Text27 & "      " & Text23
List3.AddItem Frame10 & Text28
exittxt:
CommonDialog1.CancelError = True
On Error GoTo a
CommonDialog1.Filter = "all files(*.*)|(*.*)|text file(*.txt)|*.txt"
CommonDialog1.FilterIndex = 2
CommonDialog1.Flags = &H2  '保存的时候如果有同名文件提示是否替换
CommonDialog1.ShowSave
lujing = CommonDialog1.FileName
If lujing <> "" Then
Open lujing For Output As #1
For i = 0 To List3.ListCount - 1
Print #1, List3.List(i)
Next
Close #1
End If
a:
 List3.Clear
Exit Sub
只有本站会员才能查看附件,请 登录


保存数对齐问题,当其中一位空是就出现不对齐了,能不能有更好的方法,请教各位
7 回复
#2
wp2319572014-01-03 11:03
格式化呢  定长
#3
Artless2014-01-03 11:09
结帖率:0
#4
xd123452014-01-03 13:51
指定  某行,第几格点写???
#5
风吹过b2014-01-03 14:38
你增加到 list 里的时候,就应该规定每个字段的长度,不到长度的必须补空格。

这样才保证最后保存时格式不乱。
#6
xd123452014-01-03 15:40
请帮修改下行不风吹过,就是要求这样
#7
bczgvip2014-01-03 16:01
直接使用vbtab 吧,空格的话,字体与大小也还是有所区别的。
#8
xd123452014-01-03 16:31
一句惊人,呵谢了,
1