在消息框中显示文本的新行 [英] Display a new line for a text in messagebox

查看:66
本文介绍了在消息框中显示文本的新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

假设我想在消息框中显示多行文本,请问有什么可以帮到我吗?以下是消息框文本显示的示例:-

这将使您退出系统..
继续吗?

请帮助我的代码..
我拥有vb.net 2003的所有代码,但是当我应用于vb.net 2010时,bluestring出现错误.这是我的2003代码示例:-

hi all,

Let say I want to display multiline text in messagebox, could some help me? Below is example of the messagebox text display:-

This will make you exit from system..
Continue??

Please help me with the code..
i have all code from vb.net 2003 but when i apply to vb.net 2010, it error with bluestring..Here are sample from my 2003 code:-

Dim answer as string

answer=Messagebox.Show("This will make you exit from system.." & vbCrlf & "Continue??","Exiting system", MessageBoxButtons.YesNo, MessageBoxIcon. Question)

推荐答案

我已经尝试过了在VS2010中
i have tried it in VS2010
MessageBox.Show("first line" & vbCrLf & "second line")


在字符串中,只需使用\ r \ n在两行之间添加空白行即可.
或者,只需在下一行使用\ n.

In the string, just use \r\n for add a blank row between the two lines.
Alternatively, just use \n for the next line.

Dim answer as DialogResult

answer = MessageBox.Show("This will make you exit from system.. \r\nContinue??","Exiting system", MessageBoxButtons.YesNo, MessageBoxIcon. Question)

if (answer == DialogResult.Yes) then
 'Do something

end if



默认情况下,我是c#开发人员,因此如果使用此语法无法正常工作,则应该采取措辞,但这应该为您指明正确的方向.



I am a c# developer by default, so appologies if this doesn''t work in this syntax, but this should point you in the right direction.


这篇关于在消息框中显示文本的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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