in the left picture, there is search button. when click, it will popup the second form (right picture).
when entering the keyword on search form (form2), the data will appear at the form1. how to pass the word enter by user in form2 to form1?
this is the code in form1.
private void button5_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.ShowDialog(); //open form2-search form
//kene get data input dr form2
XmlDocument xml = new XmlDocument();
xml.Load("C:\\Users\\HDAdmin\\Documents\\SliceEngine\\SliceEngine\\bin\\Debug\\saya.xml");
XmlNodeList xnList = xml.SelectNodes("/Patient/Patient/Name");
foreach (XmlNode xn in xnList)
{
string name = xn.InnerText;
listBox21.Items.Add(name);
}
}
this is the code in form2.
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
{
MessageBox.Show("Please enter keyword to search");
}
else
{
//send data input to form1.
}
can anyone help me with this? thank you
===EDIT===
i am referring to this link to solve this problem. There are two ways and i am using the second method and it works perfectly. I am crying out loud for this. thank you to the blogger owner.
i also found that, in order to view the data, i need to view it in TextBox and not ListBox. what i did before is im trying to view this in ListBox. i am not sure why but that is it. anyway, this problem SOLVE! thanks again for those who help me with this topic. i am grateful.