列表框接受文本框的用户输入 [英] List Box Accepting User Input by Text Box

查看:87
本文介绍了列表框接受文本框的用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在文本框中输入内容,单击按钮然后在列表框中显示该程序时,如何设置程序?

改进的问题:
好了,已经解决了.这只是其中的一小部分,例如当某人单击列表框中的一项时(现在只有一个地方为"example1",当他们单击该项目时,它在右侧显示了帐户名"example1",该用户名称为"potato",密码为"pickle".我已经设置了示例,但是如果有人将新项目添加到列表框中,我将如何设置它到他们还可以添加登录名和密码的位置,

How do I set up a program to when a user enters something into a text box,click a button, then it shows up in a list box?

Improved Question:
Alright,that''s been solved. That was only a small part of this,as when someone clicks an item in the list box(right now theres only one there,"example1",when they click it,it shows on the right the account name"example1",the User Name "potato" and password,"pickle". The example one was already set by me,but if someone adds a new item to the list box,how would I set it up to where they can also add a log in and password,to where if they click one that they added,that it will also show a username and password next to it?

推荐答案

遵循以下代码:

Follow the following coding:

lbx.Items.Add(tbx.Text);



将以上代码添加到按钮的click事件中.



Add the above code in your button''s click event.


尝试以下代码:
Try this code:
Private Sub button1_Click(sender As Object, e As EventArgs)
    listBox1.Items.Add(textBox1.Text)
End Sub


这篇关于列表框接受文本框的用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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