如何在文本框中输出此代码的结果? [英] How output the result of this code in a textbox?

查看:102
本文介绍了如何在文本框中输出此代码的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在文本框中输出此代码的结果,您能帮我吗?

I need to output the result of this code in a textbox, can you help me?

Sub Main()
	' Declare new StringBuilder Dim
	Dim builder As New StringBuilder

	' Append a string to the StringBuilder
	builder.Append("Here is the list:")

	' Append a line break
	builder.AppendLine()

	' Append a string and then another line break
	builder.Append("1 dog").AppendLine()

	' Get internal String value from StringBuilder
	Dim s As String = builder.ToString

	' Write output
	Console.WriteLine(s)
	Console.ReadLine()
    End Sub
End Module

推荐答案

如果您使用的是conole应用程序-那么您将无法执行此操作.
尝试改为构建Windows Forms应用程序.
If you are using a conole application - then you will not be able to do this.
Try building a Windows Forms application instead.


创建一个 ^ ]或 Web应用程序 [
Create a Windows Application[^] or Web Application[^] and add a textbox to your page/form. Depending on what you have created, put the code on the Load event of your app, remove the following lines
' Write output
Console.WriteLine(s)
Console.ReadLine()


并替换成这个


and replace it with this

TextBox1.Text = s 'Depends on the name of your TextBox on your project


这篇关于如何在文本框中输出此代码的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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