I have a scenario in c# where I open first form dialog log call it form one. Form one has a button which should open Form two. My issue is upon clicking button in form one I want to close form one and show form two as modal dialog and form two shows and still form one is not closed. Here is sample code I have tried which is not working
- private void button1_Click(object sender, EventArgs e)
- {
- Form frm=null;
- if (radioone.Checked == true)
- {
- frm=new frmPayByCash(this);
- }
- else if (radiotwo.Checked == true)
- {
- frm = new frmTwo(this);
- }
- else
- {
- frm = new frmOne(this);
- }
- if (frm != null)
- {
- this.Hide();
- frm.Closed += (s, args) => this.Close(); //have tried this but its closing both forms at ago
- frm.Show();
- }
- }
Amit GuptaPosted Sep 27, 2020, 8:09 AM
Denis MorganPosted Sep 27, 2020, 5:53 AM
Amit GuptaPosted Sep 26, 2020, 5:50 AM
Denis MorganPosted Sep 26, 2020, 4:56 AM
Amit GuptaPosted Sep 26, 2020, 4:33 AM