Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,081 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,567 people online right now. Registration is fast and FREE... Join Now!




MessageBox.Show()

 
Reply to this topicStart new topic

MessageBox.Show(), using in an if statement

rgfirefly24
23 Apr, 2008 - 09:36 AM
Post #1

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 332



Thanked: 5 times
Dream Kudos: 150
My Contributions
ok my original error was that i wanted to use MessageBox.show in an if statement and set using system.windows.form; but forgot to relate that to my bin directory. I've figured that out and wanted to hopefully delete this post, but looks like that only happens via admin.

So to add the ability to use MessageBox.Show() to your C# code do as follows:

Right click your webpage -> add asp.net folder -> select bin folder -> right click on bin folder in solutions explorer -> add reference -> scroll down to System.Windows.form -> add.

set using System.Windows.form and wala you got messagebox access...

although when using messagebox.show make sure you always set

MessageBoxOptions.DefaultDesktopOnly or else it will spit at you like a angry cobra





Is there a way for us to delete our own posts?

This post has been edited by rgfirefly24: 23 Apr, 2008 - 10:05 AM
User is offlineProfile CardPM
+Quote Post

Sonic88
RE: MessageBox.Show()
23 Apr, 2008 - 09:51 AM
Post #2

D.I.C Head
**

Joined: 19 Feb, 2008
Posts: 166



Thanked: 2 times
My Contributions
You have to ask an admin or a moderator maybe, but they wont do it unless you have really good reason. So in a nutshell no.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: MessageBox.Show()
23 Apr, 2008 - 11:05 AM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8525
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
You cannot use a MessageBox with ASP.Net, that is for Windows applications only. You will see the message if you are developing locally, but once it's deployed to the hosting server the MessageBox will appear on the server only, the user viewing your site will not see it. For displaying prompts to the user use JavaScript's alert
User is offlineProfile CardPM
+Quote Post

rgfirefly24
RE: MessageBox.Show()
23 Apr, 2008 - 11:44 AM
Post #4

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 332



Thanked: 5 times
Dream Kudos: 150
My Contributions
QUOTE(PsychoCoder @ 23 Apr, 2008 - 12:05 PM) *

You cannot use a MessageBox with ASP.Net, that is for Windows applications only. You will see the message if you are developing locally, but once it's deployed to the hosting server the MessageBox will appear on the server only, the user viewing your site will not see it. For displaying prompts to the user use JavaScript's alert



bah ok, i figured as much..... Learn to not trust msdn sites or any other coding site but DIC!

so my problem still persists

i can create the javascript alert box, however it only comes in the OK flavor. for this application i'm developing i NEED and i stress life threatening NEED it to be Yes/NO. Is there a way to mold the js alert to include yes/no?
also will this render my C# code usless?

also I have a variable which needs to send information to the 2nd page of the application. I accomplish this by using

CODE

public String A name
    {
        get
        {
            Variable1 = DropDownList1.SelectedIndex.ToString();

            Variable1 += variable2.Text;
            
            return Variable1;
        }
    }
+
<%@ PreviousPageType VirtualPath="~/my previos page.aspx" %> and A label.Text = PreviousPage.A name;


my problem is this: I need to something along the lines of this:
CODE


If (how do i determine if page is being reloaded?)
{
    A label.Text = Variable;
}
else
{
   A label.Text = PreviosPage.A name;
   Variable = PreviosPage. A name;


This post has been edited by rgfirefly24: 23 Apr, 2008 - 11:47 AM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: MessageBox.Show()
23 Apr, 2008 - 11:55 AM
Post #5

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8525
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Use JavaScript's confirm smile.gif
User is offlineProfile CardPM
+Quote Post

rgfirefly24
RE: MessageBox.Show()
23 Apr, 2008 - 12:00 PM
Post #6

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 332



Thanked: 5 times
Dream Kudos: 150
My Contributions
QUOTE(PsychoCoder @ 23 Apr, 2008 - 12:55 PM) *

Use JavaScript's confirm smile.gif



nice, i'll do some research on that, It hit 2 key points that are essential to this project.... cross-platform + cross-browser.

(i'm not so sure this project itself will be that way in the end but meh.)

anyway i saw this tutorial:
http://www.dreamincode.net/forums/index.php?showtopic=45300
will this help me in determining if the page has been refreshed?
User is offlineProfile CardPM
+Quote Post

Sonic88
RE: MessageBox.Show()
23 Apr, 2008 - 12:56 PM
Post #7

D.I.C Head
**

Joined: 19 Feb, 2008
Posts: 166



Thanked: 2 times
My Contributions
Poo the OP edited his original post completely so now my post looks really out of place...
User is offlineProfile CardPM
+Quote Post

rgfirefly24
RE: MessageBox.Show()
24 Apr, 2008 - 06:33 AM
Post #8

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 332



Thanked: 5 times
Dream Kudos: 150
My Contributions
QUOTE(Sonic88 @ 23 Apr, 2008 - 01:56 PM) *

Poo the OP edited his original post completely so now my post looks really out of place...



i left the question you answered there its all the way at the bottom of the post now.

just didnt want the only thing in my message to really be delete this. i mean how odd does it seem to open up a C# forums and read a thread called delete this lol. Figured i might as well adapt it into questions i had smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 07:43PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month