0

I have a form form1 and there is a search button for searching the doctor when i click search button then a new form opens i.e. form2 and in form2 there is a data grid view control and i want when i select any doctor and click on apply button then this doctor id and name comes onto the form1 textbox1 and textbox2.

This is for using C# window application and i am using sql database.

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Mitja Bonca
0

:yawn:To keep it simple open your second form i.e. Form2 as modal window and while closing the form you can easily access its value to Form1...
While clicking on apply retreive your required data into a public variable
Try This:

//Fomm2 Code:
//on Click event of apply button

public string DocName="Tester";//Your retreived value it will be
Close();
Form2 frm2=new Form2();
frm2.ShowDialog()
TextBox1.Text=frm2.DocName

Hope this will work....

0

if your doctor name and id and public strings, ints then you can get them on form2 by writing something like

form1.'yourstringname'
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.