using. System;
using. System.Collections.Generic;
using. System.ComponentModel;
using. System.Data;
using. System.Drawing;
using. System.Linq;
using. System.Text;
using. System.Windows.Forms;
namespace. WindowsFormsApplication13.
{.
Public. partial. Class. Form1. :. Form.
{.
Public. Form1 ().
{.
InitializeComponent ();
}.
Private. void. List1_SeletedIndexChanged (. object. sender,.EventArgs. e).
{.
int. List1.SelectedIndex = index;
display.Text = list1.Items [index]. ToString ();
}.
Private. void. List2_SelectedIndexChanged (. object. sender,.EventArgs. e) {.
int. List2.SelectedIndex = index;
display.Text = list2.Items [index]. ToString ();
}.
}.
}.
โปรแกรมที่12.5
using. System;
using. System.Collections.Generic;
using. System.ComponentModel;
using. System.Data;
using. System.Drawing;
using. System.Linq;
using. System.Text;
using. System.Windows.Forms;
namespace. WindowsFormsApplication13.
{.
Public. partial. Class. Form1. :. Form.
{.
Public. Form1 ().
{.
InitializeComponent ();
}.
Private. void. List1_SeletedIndexChanged (. object. sender,.EventArgs. e).
{.
int. List1.SelectedIndex = index;
display.Text = list1.Items [index]. ToString ();
}.
Private. void. List2_SelectedIndexChanged (. object. sender,.EventArgs. e) {.
int. List2.SelectedIndex = index;
display.Text = list2.Items [index]. ToString ();
}.
}.
}.
โปรแกรมที่12.6
using. System;
using. System.Collections.Generic;
using. System.ComponentModel;
using. System.Data;
using. System.Drawing;
using. System.Linq;
using. System.Text;
using. System.Windows.Forms;
namespace. WindowsFormsApplication14.
{.
Public. partial. Class. Form1. :. Form.
{.
Public. Form1 ().
{.
InitializeComponent ();
}.
Private. void. Add_Click (. object. sender,. EventArgs. e) {.
string. STR = Text.Text; / /. read data into a text box. STR.
ListBox.Items.Add (STR); / /. applet. Add (). add the item.
}.
Private. void. Delete_Click (. object. sender,. EventArgs. e) {.
int. ListBox.SelectedIndex = index; / /. Read the index of the item selected.
ListBox.Items.RemoveAt (index); / /. delete data in the selected location.
}.
Private. void. Clear_Click (. object. sender,. EventArgs. e) {.
ListBox.Items.Clear (); / /. Clear the items in the list box.
}.
}.
}.