i made a reservation system and in first form user should choose [One Way] or [Round Trip]
[one way or round trip as radiobuttons ].if user choosed round trip should fill form2 befor submit
but my issue [if the user after choosed round trip then form2 opend ,user closed the form2 i want in this case the system made one way radio button checked by default in form1]

Thank you

Hi,

1. Declare a static variable bool m_bReturnTripIsSelected in the first form.
2. Declare the

private void Form1_Activated(object sender, System.EventArgs e) 
{
if(m_bReturnTripSelected)
{
returnTripRbutton.Enabled = true;
}
}

- this will fire once the form is focused - [http://msdn.microsoft.com/en-us/library/system.windows.forms.form.activate(VS.71).aspx]
3. On Form2_FormClosing call the static property for m_bReturnTripIsActive and set it true (if round trip failed).


Hope this helps.

sorry correction [at point 3]
3. On Form2_FormClosing call the static property for m_bReturnTripIsSelected and set it true (if round trip failed).

Or you can use delegates, which will call some method on form where you have radioButton, which will be checked before form from where is it called, will close.

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.