cad sunny

cad sunny

  • 1.5k
  • 138
  • 21.7k

listbox item edit using with new form

Oct 9 2014 3:49 AM
   Reply 

hi,
i tried below code for first i select listbox item then i click edit button for text name change.

form1
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
 
private void btnOpenForm2_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(this);
f2.ShowDialog();
}
 
public string ListBoxValue
{
get { return listBox1.SelectedItem.ToString(); }
}
}
 

form2
 
public partial class Form2 : Form
{
Form1 f1;
public Form2(Form1 f1)
{
this.f1 = f1;
InitializeComponent();
}
 
private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = this.f1.ListBoxValue;
}
}
 
above code is work well,but after open form2 for editng text its not updated same text in listbox selected item.its added new item in listbox.plz help me to solve this problem


rgds
cad