TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Denis Morgan
NA
72
22.2k
How to close current form in C# and open the second form as modal dial
Sep 26 2020 4:24 AM
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();
}
}
Reply
Answers (
5
)
Bind Drop Down List.
How to integrate payment getway in asp.net mvc