两个文本框数据如何“添加”在C#语言的Listview Box中 [英] Two text boxes data how to "ADD" in Listview Box in C# language

查看:97
本文介绍了两个文本框数据如何“添加”在C#语言的Listview Box中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友



我初学C#语言和编程。所以请尽快提供我的Quesion中的代码

语言:C# .net。

问题:Iam使用两个文本框和一个按钮(ADD),Listview Control.so我的问题是每当我在文本框中输入一些数据并单击添加按钮然后自动将该数据存入列表浏览怎么样??? .........





预付谢谢

Sheshu

hi Friends

Iam beginner of the C# Language and Programming.so please provide the code in my Quesion ASAP
Language : C#.net.
QUESTION : Iam Using Two text boxes and One Button(ADD),Listview Control.so my Question is Whenever I enter some data in text boxes and Click Add button then Automatically that dat astored in Listview HOW???.........


Thanks In Advance
Sheshu

推荐答案

您可以使用以下代码作为方法。

将列表视图控件和textbox1和textbox1中的文本作为单独的函数传递呼召。



You may use the following code as a method.
pass your list view control and the text from textbox1 and textbox1 as separate function callings.

private void AddItemtoListViewControl(ListView lst,string sText)
        {
            string sItem = sText;
            lst.Items.Add(sItem);
        }


private void button1_Click(object sender, EventArgs e)
{
     listBox1.Items.Add(textBox1.Text.Trim() + textBox2.Text.Trim());
}


这篇关于两个文本框数据如何“添加”在C#语言的Listview Box中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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