如何在文本框中显示值的输出? [英] how to show output of value in textbox?

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

问题描述

我想显示我在文本框中的值的结果...为此我使用了一个文本框和一个按钮...我的前端代码是



i want to show result of my values that are in textbox... for this i've used a textbox and a button... my front end code is

 <asp:TextBox ID="txtCode" runat="server" Height="240px" Width="100%" 
            TextMode="MultiLine">
<asp:Button ID="btn_output" runat="server" onclick="btn_output_Click" 
            Text="Output" />





i在编译后显示控制台应用程序的输出...如何在文本框中显示所有控制台应用程序的结果?或者它将通过其他方式完成,例如在exe或cd(命令提示符)...



我的后端代码是



i am working on showing the output of console applications after compiling them... how do i show the result of all console applications in the textbox? or it will be done with some other way like on exe or cd(command prompt)...

my backend code is

protected void btn_output_Click(object sender, EventArgs e)
        {
            txtCode.Text = "Hello World";
        }





因为这是一个硬编码(hello world),我怎么能显示其他控制台应用的结果通过不硬编码吗?



as this is a hard-code(hello world), how can i show the results of other console apps by not hard coding them?

推荐答案

好吧,一种方法是将EXE的输出重定向到一个临时文件,然后在你的ASP中读取该临时文件和将内容放在文本框中。



你的IIS必须设置好以便你可以运行EXE,当你运行它时管道输出(使用>符号,如dir> c :\mysite\myfile.txt)。然后,您可以刷新页面以在添加文件时再次读取文件,或者我确定有一些很酷的java技巧可以刷新页面的一部分。您还需要确保不要碰撞名称(使用GUID或其他东西),以便多个客户端不读取其他人的文件。
Well, one way would be to redirect the output of the EXE to a temporary file, then in your ASP read that temporary file and place the contents in the textbox.

Your IIS would have to be set up so that you can run EXE's and when you run it pipe the output (using the > sign, like dir > c:\mysite\myfile.txt). You can then refresh the page to read the file again as it gets appended, or I'm sure there's some cool java trick to just refresh part of the page. You'll also need to make sure that you don't collide names (use GUID's or something) so that multiple clients don't read other peoples files.


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

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