用c清除这个疑问 [英] clear this doubt in c sharp

查看:51
本文介绍了用c清除这个疑问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时在文本框中存储多个输入,并在列表框中显示输出.

为此,我使用for循环获取多个输入,我该如何存储它呢?
我放置了两个文本框,一个用于获取名称,另一个用于年龄.我将提供多个人的姓名和年龄,并将其显示在列表框中.

I want to store multiple inputs at run time in the text box and displays the output in listbox.

for this am using for loop to get multiple inputs and how can i store it???

I placed two text boxes , one for getting name and other for age. I am going to give multiple persons name and age and I''m going to display it in list box. what shall I do for this????

推荐答案

不起作用.

问题是Windows编程(以及文本框"和列表框"引用表示您正在为GUI环境编程)无法像使用基于控制台的应用程序那样与循环一起使用.相反,它与事件一起使用,事件在用户执行某项操作(或系统中发生其他操作)时发生.

您需要回到您的讲义中,或者更仔细地阅读并读书-有一些基本细节您已经被掩盖或尚未理解.
Not going to work.

The problem is that Windows programming (and the "Text Box" and "List Box" references say you are programming for a GUI environment) does not work with loops like you are used to with console based applications. Instead, it works with Events which occur when the user does something (or when something else happens in the system).

You need to go back to your lecture notes, or book and read more carefully - there are fundamental detials you have either glossed over or not understood yet.


如果您正在开发基于Window的应用程序,无需使用for循环.您可以在UI上有一个按钮,单击该按钮后会将输入(来自指定文本框)添加到列表框中.

为此,您必须处理该按钮的点击事件"(我们可以将其称为添加按钮").在此添加"按钮单击事件上,您必须执行一些操作,例如将textboxex中的内容添加到列表中并清除它们(以便用户可以看到添加的内容,并准备添加下一个内容).
If you are developing Window based application, no need to use for loop. You can have a button on your UI which when clicked, you add the inputs (from your specified textboxes) to the listbox.

For that matter you''ve to handle the ''Click Event'' of that button (we can call it ''Add Button''). On this ''Add'' button click event you have to perform activities like adding the content from textboxex to list and clearing them (so that user can visualize the content adding, and is ready to add next content).


这篇关于用c清除这个疑问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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