已有141人关注
运行程序后,如何在textBox里面显示输出内容
发表在C#答疑区 2017-10-21 悬赏:2 学分
是否精华
版块置顶:

尊敬的老师:

    上午好

   运行程序后, 我想在textBox里面显示输出 X=3   

                              Y=4

                              M=5

这三行内容。


那么在textBox事件里面应该如何写这样的代码呢?才能在运行程序后,输出这三行内容?


分享到:
精彩评论 4
小禾斗
学分:7308 LV13
TA的每日心情
奋斗
2017-04-21 14:00:25
2017-10-23
沙发

读者朋友:

  您好,通过设置Text属性,显示多行的话,可以在显示的内容里面加入换行(\n)。

chongchong
学分:1922 LV9
2017-10-23
板凳

小禾斗 发表于2017-10-23 08:32

读者朋友:

  您好,通过设置Text属性,显示多行的话,可以在显示的内容里面加入换行(\n)。

老师:您好


 显示是显示了,就是没换行,是怎么回事呢?

namespace 三菱PLC

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();


            textBox1.Text = "x=3\nY=4\nz=5";


        }


chongchong
学分:1922 LV9
2017-10-23
地板

小禾斗 发表于2017-10-23 08:32

读者朋友:

  您好,通过设置Text属性,显示多行的话,可以在显示的内容里面加入换行(\n)。

老师:


我怎么测试都不行,显示是可以显示了,就是无法换行。

代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.IO.Ports;





namespace 三菱PLC

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();


            textBox1.Text = "x=3\nY=4\nz=5";


        }

    

}

小禾斗
学分:7308 LV13
TA的每日心情
奋斗
2017-04-21 14:00:25
2017-10-24
4L

chongchong 发表于2017-10-23 11:58

老师:


我怎么测试都不行,显示是可以显示了,就是无法换行。

代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.IO.Ports;





namespace 三菱PLC

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();


            textBox1.Text = "x=3\nY=4\nz=5";


        }

    

}

中间连接用Enviroment.NewLine试一下。

首页上一页 1 下一页尾页 4 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照