惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
C
Cisco Blogs
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
L
LINUX DO - 热门话题
I
InfoQ
GbyAI
GbyAI
NISL@THU
NISL@THU
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
TaoSecurity Blog
TaoSecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
A
About on SuperTechFans
Spread Privacy
Spread Privacy
月光博客
月光博客
W
WeLiveSecurity
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
Security Latest
Security Latest
人人都是产品经理
人人都是产品经理
PCI Perspectives
PCI Perspectives
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
T
Troy Hunt's Blog
Martin Fowler
Martin Fowler
The Hacker News
The Hacker News
T
Tor Project blog
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
Stack Overflow Blog
Stack Overflow Blog
K
Kaspersky official blog
Cloudbric
Cloudbric
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
D
DataBreaches.Net
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - Franky
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog

博客园 - 岳洋

关键词:vb.net 扑克 cards.dll 网上较好的提取链接的正则表达式 下载网页源代码的程序 一个读取网页源代码的小程序 file manager 0.1 circleliner阅读笔记 panel的使用 用于学习鼠标作图的网页。 用旧方法文件读写 - 岳洋 - 博客园 Birthday Reminder Framework 1.1版本 Birthday Reminder (R Edition) ver1.0 build 050813正式发布! 050627ReciteDemo0.2 050626诗歌背诵程序demo 050615 B-A-M v1.0源代码 050615 Bact.-Anti-Med.ver1.0正式发布! 新建一个按钮至少需要做的事情…… 我决定不再和窗体设计器争生意了! 050614Bact.-Anti-Med.v0.3最新更新 按钮的突然消失!(小记一次编程失误)
写文件时换行的问题[转载] by 東風耐候 - 岳洋
岳洋 · 2005-12-18 · via 博客园 - 岳洋

写文件时换行的问题

有时候可能会用一个变量来保存多行数据:
"这是第一行.
这是第二行.
这是第三行.
…………
…………”

我试着在行后添加换行符chr(10)或回车符chr(13)来实现换行,但是效果并不好:
strLines="这是第一行."+chr(10) _
+"这是第二行."+chr(10) _
+"这是第三行."+chr(10) _
+"…………"+chr(10) _
+" …………"

文件写入后,如果用写字板来打开应该会看到换行后的效果,但是,通常我们只用记事本来打开,这时候却不会换行了。

实际上,查看VB相关资料,很多都已经给出建议使用chr(13)+chr(10)来进行换行,如下面的写法,就比较完美:

strLines="这是第一行."+chr(13)+chr(10) +_
+"这是第二行."+chr(13)+chr(10) _
+"这是第三行."+chr(13)+chr(10) _
+"…………"+chr(13)+chr(10) _
+" …………"

除此之外还有一个就是:vbCrLf,用它也是可以的:

strLines="这是第一行."&vbCrLf_
+"这是第二行."&vbCrLf _
+"这是第三行."&vbCrLf _
+"…………"&vbCrLf _
+" …………"