Visual Basic:空间 [英] Visual Basic: Space

查看:116
本文介绍了Visual Basic:空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以用什么在txtbox1和txtbox2之间留出空格:



我的意思是看:


此代码中


MsgBox(学生&txtName.Text&txtLastName.Text +在商标上非常棒)



它显示:StudentJohnDwight非常擅长分数





我该如何做到这样的节目:学生john Dwight很擅长标记?

解决方案

使用此



 MsgBox( 学生& txtName.Text&  & txtLastName.Text&  非常适合标记





和BTW,您的代码不起作用..您正在使用+运算符进行连接


作为替代方案,您可以使用String.Format [< a href =http://msdn.microsoft.com/en-us/library/system.string.format.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1target = _blanktitle =新窗口> ^ ]方法:

  Dim  msg 作为 字符串 
msg = 字符串 .Format( 学生{0} {1}非常适合标记,txtName.Text, txtLastName.Text)
MsgBox(msg)


Hi, What can i use to have a space between txtbox1 amd txtbox2:

I mean Look:

in this code here
MsgBox("Student " & txtName.Text & txtLastName.Text + "are great at marks")

It displays: StudentJohnDwight are great at marks


How can I do to shows like that: Student john Dwight are great at marks?

解决方案

Use this

MsgBox("Student " & txtName.Text & " "& txtLastName.Text &" are great at marks")



And BTW, your code does not work.. You are using + operator for concatening


As an alternative, you may use the String.Format[^] method:

 Dim msg As String
 msg = String.Format("Student {0} {1} are great at marks", txtName.Text, txtLastName.Text)
MsgBox(msg)


这篇关于Visual Basic:空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆