使用列表框从文本框中保存数据并在组合中获取此数据 [英] using list box to save data from textbox and getting this data in combo
本文介绍了使用列表框从文本框中保存数据并在组合中获取此数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好每个人
在我的应用程序中我有2个表格在第一我有文本框和列表框所以我必须将数据从文本框保存到列表框
和第二表单我需要在下拉列表中获取列表数据
任何建议
thnx提前
hello everyone
in my app i have 2 forms in 1st i have textbox and listbox so i have to save data from text box to list box
and in 2nd form i need to get the data of list in dropdown
any suggestion
thnx in advance
推荐答案
It很难弄清楚你在这里想做什么 - 你的问题不是很清楚。
所以我真的不能给你代码!
假设您有两种形式:Form1和Form2。 Form1有一个文本框。
如果Form1上的按钮打开Form2,你想在From2上设置一个值到文本框的内容:
1)创建一个带有字符串参数的Form2构造函数,并直接用字符串构造它,
或
2)在Form2中创建一个字符串属性,它可以接受该值,
2.1)在创建它之后和调用ShowDialog之前设置Form2实例属性。
如果你想要一个按钮在Form2上从Form1获取一个值然后这有点复杂 - 问我会告诉你。
It''s difficult to work out exactly what you are trying to do here - your question is not very clear.
So I can''t really give you code!
Let''s say you have two forms: Form1 and Form2. Form1 has a textbox.
If a button on Form1 opens Form2 and you want to set a value on From2 to the content of the textbox:
1) Either create a Form2 constructor that take a string parameter, and construct it with the string directly,
or
2) Create a string property in Form2 which can accept the value,
2.1) Set the Form2 instance property after your create it and before you call ShowDialog.
If you want a button on Form2 to fetch a value from Form1 then that is a little more complex - ask and I''ll tell you.
这篇关于使用列表框从文本框中保存数据并在组合中获取此数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文