Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi all,

I am now developing a window form in Visual Studio. there are two form in my project. When I click button show in Form1 then It will popup the form2, but I cannot do it. Please help me any solution. Thank you in advance.
Posted
Comments
[no name] 5-Dec-11 23:22pm    
i posted a solution. pls see

On button click event of button in Form1, make an instance of your Form2, do the below codes.

C#
Form2 form2 = new Form2();
form2.Show();


Please mark as answer and vote 5 if this solved your problem

Regards,
Eduard
 
Share this answer
 
Comments
Manoj K Bhoir 5-Dec-11 23:35pm    
My 5!
[no name] 6-Dec-11 1:30am    
thanks!
phanny 2011 5-Dec-11 23:36pm    
Thank you so much. If I want to change some style of this window, how?
[no name] 5-Dec-11 23:52pm    
form2.----- = xxxxxx;
in form 1 button click event enter the following code

C#
{
form2 frm = new form2(); //it will initialize the object frm for form 2 in form 1
frm.Show();// this will opening form 2

//if you want to hide form 1 then
this.Hide();
}
 
Share this answer
 
v2
try this.

inside the button_Click event,

C#
form2.show();


hope it helps

don't forget to vote

thank
 
Share this answer
 
v2
Comments
phanny 2011 5-Dec-11 23:17pm    
I have to write it in Form1.cs right? but It doesn't know function show(). Thanks
first u have to create object of form 2 in form1 .cs
then call show method of form 2



C#
in form1.cs

on buttin click method


{
form2 frm = new form2(); // object of form 2
frm.Show() // it will pop up your form 2
}
 
Share this answer
 
v2
Please mark as answer and vote





<ajax:modalpopupextender id="ModalPopupExtender1" runat="server" targetcontrolid="btnShowModalPopup" xmlns:ajax="#unknown">
PopupControlID="panelDragHandle" BackgroundCssClass="modalBackground" OkControlID="btnOk">

<asp:panel runat="server" id="panelDragHandle" cssclass="modalPopup" width="70%" xmlns:asp="#unknown">

<asp:button id="btnOk" runat="server" text="Ok">



In c#:

if (e.CommandName == "Popup")
{
LinkButton id = (LinkButton)e.Item.FindControl("LinkButton1");
string custID = id.Text;
ModalPopupExtender1.Show();

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900