C# Update ListBox Item

How To Update ListBox Selected Item In C#


In This C# Tutorial We Will See How To Display Selected Listbox Item Into TextBox And Edit It With A New Value From The TextBox Using CSharp Programming Language And .

Source Code :

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 WindowsFormsApplication1
    public partial class ListBox_Form : Form
        public ListBox_Form()

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
                textBox1.Text = listBox1.SelectedItem.ToString();


        private void BTN_UPDATE_Click(object sender, EventArgs e)
            int index = listBox1.SelectedIndex;
            listBox1.Items.Insert(index, textBox1.Text);

=> OutPut :

c# edit listbox selected item

Share this

Related Posts

Next Post »