I have successfully implemented similar code in other projects but for some reason its not working here. does anyone have any suggestions
namespace
TreasuryHelpDesk.controls //I have taken out the other code.{
private void Page_Load(object sender, System.EventArgs e){
TechnicianDataAdapter.Fill(userNameDataSet1.Users);
lbTech.DataBind();
//lblHeader.Text = "Technicians in " + Request.QueryString["name"].ToString();}
private void btnAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e){
//Over HERE guys: it returns a null reference exception. i don't know why. the list box is full of the relevant values but no hope :(
System.Web.UI.WebControls.ListItem Tech =
new ListItem(lbTech.SelectedItem.Text,lbTech.SelectedValue.ToString());//lbTech.SelectedItem.Text has values i can see. but the code fails to retrieve them.
lbTechToEmail.Items.Add(Tech);
lbTech.Items.Remove(Tech);
}
private void btnRemove_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
System.Web.UI.WebControls.ListItem Tech = new ListItem(lbTechToEmail.SelectedItem.Text,lbTechToEmail.SelectedValue.ToString());
lbTech.Items.Add(Tech);
lbTechToEmail.Items.Remove(Tech);
}
private void lbTech_SelectedIndexChanged(object sender, System.EventArgs e)
{
//lblHeader.Text = lbTech.SelectedValue.ToString();
}
private void lbTechToEmail_SelectedIndexChanged(object sender, System.EventArgs e){
}
}
}

Why is my code not retrieving the selecteditem.text in my list box control???
Danny Ah
the doce above is the problem code. the listbox gets filled on eaach roundtrip
use it in this way
NoSTaBoNN
KeithM
hi,
for web forms development you can ask in this forum http://forums.asp.net
hope this helps