i have created popup form in which listbox is used.when clicked on any item in listbox that value should be pass to the parent form for further processing.
Please help me urgently
thank u in advance
Hi avni,
In this case first thing you have to do is to create a public property in the parent Form. Then in the SelectedValueChanged event handler of the listbox in the popup Form set this property to the selected value of the listbox.
For an example..
-
private void listBox1_SelectedValueChanged(object sender, EventArgs e)
-
{
-
((Form1)ParentForm).label1.Text = listBox1.SelectedValue.ToString();
-
}
-
Here Form1 is the type of the parent form. You have to cast the ParentForm property to the particular type. Since label1 is a public member of Form1, I can change the value of the Text property of it, from the popup form.
Hope this will make sence to you.
Regards
Channa