如何在vb.net中逐行显示文本? [英] How to display text line by line in vb.net ?

查看:313
本文介绍了如何在vb.net中逐行显示文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在vb.net
中逐行显示文本
我叫弗雷德

我今年23岁

我来自马六甲

i want to display a text line by line which is something like this in vb.net

My name is Fred

I am 23 years old

I am from Malacca

推荐答案

请详细说明文本在文本框中的显示位置

您可以编写如下

Please be more specific about where you want to display the text if it is in a textbox

You can write as below

txtMyInfo.Multiline = True
txtMyInfo.Text= "My name is Fred" & vbCrLf & "I am 23 years old" & vbCrLf & "I am from Malacca"



或是否在标签中



or if it is in a label

'The more VB style way
Label1.Text = "Hello" + vbCrLf + "How are you?"

or
'This works in almost any (.NET) language way
Label1.Text = "Hello" + Environment.NewLine +"How are you?"


如果它是文本框控件,请选择文本框并从属性更改Multiline = True.

或者,如果您使用标签控件,则选择标签,然后从适当的位置更改Autosize = False并重新设置大小.
If it is a textbox control then select the textbox and from properties change Multiline = True.

or if you use label control then select the label and from propersites change Autosize=False and re size.


这篇关于如何在vb.net中逐行显示文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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