注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

樊芳芳 廊坊师范学院信息技术提高班十四期

 
 
 

日志

 
 

关于VB代码换行问题  

2017-01-21 17:04:41|  分类: VB学习 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
       这几天敲VB的进度有点慢,但是总算也有点收获了。遇到了一个很有意思的问题,就是关于代码续行。如果代码窗口里要输很长的一段内容,你不可能不换行地一直输下去吧,太傻了。当然,我前面就是这么傻傻地过的。因为之前也遇到过代码换行的问题,但是由于老是出错,代码也不是特别长,我就没有换行,直接一行敲过去的。直到前一阵子,出现了一段要输的内容我就傻眼了。以下就是我的例子:
        我开始是这么输的:
  Text1.Text = "In the United States Nowadays, More Than A Third of all _ 
   Students Are Women. Although Many Women Who Have Received Heighter Education Do Not _
   Spend The Whole of Their Lives Following Careers For Which Their Education Has _ 
   Prepared Them. It Is Accepted That The Benefits Of A University Carrer Are Useful."
但现实的结果是:编译错误,缺少结束语句。
后来上网查了一下,给出了这样的方法:
  Text1.Text = ""
  Text1.Text = Text1.Text & "In the United States Nowadays, More Than A Third of all"
  Text1.Text = Text1.Text & "Students Are Women. Although Many Women Who Have Received Heighter Education   Do Not"
   Text1.Text = Text1.Text & "Spend The Whole of Their Lives Following Careers For Which Their Education Has"
   Text1.Text = Text1.Text & "Prepared Them. It Is Accepted That The Benefits Of A University Carrer Are Useful."
但是还有一种方法:
  Text1.Text = "In the United States Nowadays, More Than A Third of all" & _(&和_之间有空格)
  "Students Are Women. Although Many Women Who Have Received Heighter Education Do Not" & _
  "Spend The Whole of Their Lives Following Careers For Which Their Education Has" & _
  "Prepared Them. It Is Accepted That The Benefits Of A University Carrer Are Useful."
方法不唯一,我两种都试过了,都可以。
 之前有问题没总结就这么过去了,遇到问题的时候就着急了。所以还是要做好及时总结的习惯。
 
  评论这张
 
阅读(44)| 评论(27)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017