I am developing a Windows Form type solution that contains two forms:
Form frm_open_window :
Fields:
- (1) Button "Open": Open the form called frm_nueva_ventana .
When this button is pressed, it must be locked. Example: Abrir.Enabled = false;
Form frm_nueva_ventana :
Fields:
- (1) RadioButton: Determines if the form button frm_snap_window is enabled.
- (1) Button Finish: Close the current form (frm_nueva_ventana) and you must enable the form button frm_open_window strong>.
I was reviewing this question , but it does not apply to the situation I describe in my question.
The flow of the program is as follows:
Abrir
of the form frm_open_window . OnClick
event of the Abrir
button opens an instance of the frm_new_window form and locks the Abrir
button. RadioButton
. Finalizar
button, sending the checked
(boolean) of the RadioButton
to the first form that is, frm_open_window . Enabled
to the button Abrir
of the form frm_open_window . To summarize, the problem I have at this moment is to send a boolean value between these two forms ; When the second form finishes its functionality, it must close and enable the Abrir
button again.
This is my current code:
Form code frm_open_window :
/// Propiedad pública del formulario "para habilitar el botón (Abrir)".
public bool EstadoBoton { get; set; }
/// <summary>
/// Abrir segundo formulario (frm_nueva_ventana).
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnAbrir_Click(object sender, EventArgs e)
{
frm_nueva_ventana frmNewVnt = new frm_nueva_ventana();
frmNewVnt.Show();
btnAbrir.Enabled = false;
}
Code frm_nueva_ventana :
/// <summary>
/// Cerrar actual formulario (frm_nueva_ventana) y enviar
/// el checked del RadioButton al botón del primer formulario.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnFinalizar_Click(object sender, EventArgs e)
{
// frm_abrir_ventana aún está abierta y debe estarlo.
// por lo que no sé tampoco cómo detectar este proceso.
frm_abrir_ventana frmAbrVnt = new frm_abrir_ventana();
frmAbrVnt.Show();
frmAbrVtn.EstadoBoton = true;
}
How can I set this functionality correctly?