开发者

Function to Get POP UP Window in stand alone application using c sharp

i am facing a problem with Getting a pop up message through pop up window in a stand alone application using c sharp.please help us ,thanks in advance.

I want to pop up a message to user to perform task at pa开发者_运维百科rticular time .then i need to send the message to user through pop up window thats my requirement. i am writing console application programs.

Regards, M.Channabasappa


If you have console project - the best user message would, of course, console message. But If you still want to send pop up message to user just add reference to System.Windows.Forms assembly to your project and call message box:

System.Windows.Forms.MessageBox.Show("Hello! Im console app");


In WinForms, you need Form.ShowDialog(). In WPF, it's Window.ShowDialog().

To achieve a modal popup on a website is more tricky. Only IE really supports modal popups, and they don't "feel" nice to use. You can use bits of jQuery UI to get what looks like a popup but is in fact a div layered over the top of the whole page, inside the browser window.

HTH.


Anton's answer is correct, but in my case (Visual Studio 2010, Win7), I had to add System.Windows.Forms to my project as a reference to get it to work.

To do so, right click on your project in Solution Explorer > Add Reference > .NET tab > System.Windows.Forms > OK

Once I did this, I was able to add a MessageBox to a console application, which while it seems a bit counter intuitive was a good solution for this particular problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜