i have 16 Items in listBox1 and one button "button1", i need to to be able to move the selected Item from listBox1 to listBox2 when a button is pressed. currently my code is
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;
using System.Xml;
using System.IO;
namespace courseworkmodule
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
String workingDir = Directory.GetCurrentDirectory();
XmlTextReader textReader = new XmlTextReader(workingDir + @"\modules.xml");
Console.WriteLine("BaseURI:" + textReader.BaseURI);
textReader.Read();
while (textReader.Read())
{
textReader.MoveToElement();
if (textReader.Name == "Name")
{
textReader.Read();
XmlNodeType nType = textReader.NodeType;
if (nType == XmlNodeType.Text)
{
listBoxAllModules.Items.Add(textReader.Value);
}
}
}
Console.ReadLine();
textReader.Close();
}
public void button1_Click(object sender, EventArgs e)
{
listBoxStudentModules.Items.Add(listBoxAllModules.SelectedItem);
}
private void Form1_Load_1(object sender, EventArgs e)
{
}
private void listBoxAllModules_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
where listBoxAllModule is listBox1 and listBoxStudentModule is listBox2 thanks in advance for any help