Hello Friends,

I need help on the below issue

I have two forms
-DoctorAppointment
-DoctorSchedule

the DoctorAppointment form has all the details about the doctor and the patient and one Schedule button which will show the DoctorSchedule form

When I click on any value in the DoctorSchedule form like Monday or any other day and click on save button it opens a new DoctorAppointment form and store the Day value in the text box of the form.

The old DoctorAppointment form stays as it is but the new DoctorAppointment form that appears after DoctorSchedule Save click it removes all the earlier values (doctor and patient Details) that were present on the DoctorAppointment Form.

I want that after the Save click it should not call any new form instead the Day value should come on the old form including the Doctor and Patient Details.

Can anyone help me in this?

hello !
i cant get ur point , u just want to move value of the textbox from one form to another or u want to save it then it will show in the previous form ? please rephrase it

Regards

M.Waqas Aslam

If i understand this correctly, there are different ways of doing this.

Approach one
In the DoctorSchedule new Contructor, you can say that it requires DoctorAppointment variable and then when click save you can access the DoctorAppointment fields direclty.

Not sure if that is the best way of doing it.

Approach two
You can create a public Property on the DoctorAppointment form which you can set via the DoctorSchedule Save Click event

hello !
i cant get ur point , u just want to move value of the textbox from one form to another or u want to save it then it will show in the previous form ? please rephrase it

Regards

M.Waqas Aslam

Ok Let me rephrase it

I have 2 forms....
When I click on the button of first form it redirects me to the second form which has a datagrid.
When I select any value from the datagrid and click on a button avaialble in the same form the value that I get from the datgrid shoud be displayed on the first form again

But the issue that I am facing is....
When I click on the button of the second form it open the new first form and the earlier values that were there eneterd manually on the first form goes away....

Ok Let me rephrase it

I have 2 forms....
When I click on the button of first form it redirects me to the second form which has a datagrid.
When I select any value from the datagrid and click on a button avaialble in the same form the value that I get from the datgrid shoud be displayed on the first form again

But the issue that I am facing is....
When I click on the button of the second form it open the new first form and the earlier values that were there eneterd manually on the first form goes away....

Thats why you mustn't create a new form, just use the form.hide/show methods.

Ok Let me rephrase it

I have 2 forms....
When I click on the button of first form it redirects me to the second form which has a datagrid.
When I select any value from the datagrid and click on a button avaialble in the same form the value that I get from the datgrid shoud be displayed on the first form again

But the issue that I am facing is....
When I click on the button of the second form it open the new first form and the earlier values that were there eneterd manually on the first form goes away....

u should check ur load event of the first form , use this code on the button of the 2nd form.

form1.textbox1.text = datagridview1.item(columnindex,datagridview1.currentrow.index).value.tostring
form1.show()
me.close()

this will work fine , if u face same prob then please show ur code here so that we can find any mistake or u can check again , there should be some logical mistake from ur side ,
Hope this will helps u

Regards

M.Waqas Aslam

Thats why you mustn't create a new form, just use the form.hide/show methods.

Thank u...it solved my problem.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.