hello everyone,
how to write exit code in visual studio.Net so that whole program closes on button click event?
And how Message box is created, also how to take input from user as we do in javascript using prompt command?
Can anyone help me in this.....
Thanx in advance.

i got the exit code. i am writing here if it helps anyone..
this will be written within button click event

Response.Write("<script>window.close();</script>")

And also like below we can write by assigning attribute.
This we will write in page load event

Button1.Attributes.Add("OnClick", "window.close();")

This both codes will close the window we are using on clicking the exit button.

But still i dont noabout message box with taking the input from user can anyone help me in that...

hello everyone,
how to write exit code in visual studio.Net so that whole program closes on button click event?
And how Message box is created, also how to take input from user as we do in javascript using prompt command?
Can anyone help me in this.....
Thanx in advance.

hi ruhi
this is naman.
well your quest is very nice.

if you r talking about vb.net then there is one function "END()"
write it in to the button click event.
and for the message box.
there is one function "msgbox("your message")" write it anywhere in any button click or the page load event.

Actually i m using visual studio .net but thanks for your reply naman and i just got the answer.If any one would like to refer...
In the parent page we will have say one textbox and one button then the code for it is
parent.aspx
in html code we have

<asp:TextBox id="first" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server"></asp:TextBox>
    <asp:Button id="Input" style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 24px" runat="server" Text="Open..."></asp:Button>

and parent.aspx.vb
in page load event we will write

Input.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('first').value=strReturn;")

And suppose child page
child.aspx
if it contains one textbox and two buttons again in html window

<asp:TextBox id="second" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server"></asp:TextBox>
    <asp:Button id="btnOK" style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 56px" runat="server" Text="Ok" Width="56px"></asp:Button>
    <asp:Button id="btnCancel" style="Z-INDEX: 102; LEFT: 112px; POSITION: absolute; TOP: 56px" runat="server" Text="Cancel"></asp:Button>

and child.aspx.vb will have in the page load event

btnOK.Attributes.Add("onclick", "window.returnValue = document.getElementById('second').value; window.close();")

  btnCancel.Attributes.Add("onclick", "window.close();")

Complete.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.