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();
- frm.Show();
- }
- }