Android Tutorial , Programming Tutorial, Php Tutorial, Learn Android, HTML Tutorial, Coding , Java Tutorial, GTU Programs, Learning Programming

Saturday, 22 October 2016

Add text from textbox in listbox Column in C#

In this example, We are learning how to add items in listbox from textbox on button click.

Let's see the example :

File Name : Form1.cs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Item_Add_ListBox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            item_listbox.Items.Add(txt_item_add.Text);
            txt_item_add.Text = "";
            
            //item_listbox = name of listbox
            //txt_item_add = name of textbox


        }
    }
}

Output :

Listbox add item

ListBox Item add



0 comments:

Post a Comment

Like us on Facebook

Site Visitor

Powered by Blogger.