MessageBox.Show not working at all

14,162

Solution 1

When you build a Windows Phone Project it automatically generates all the required dependencies for you. You should be able to in your class file and add the following using statement:

using System.Windows

Once you've done that you'll be able to implement the MessageBox class. If not, then you'll need to do the following:

  1. Open Solution Explorer
  2. Right Click Reference Folder
  3. Add Reference
  4. Go to Assemblies
  5. Go to Browse
  6. Navigate to: C:\Windows\Microsoft.Net\Assembly\GAC_MSIL\PresentationFramework
  7. Reference PresentationFramework.dll

Once you've referenced that library, you'll be able to call: MessageBox.Show(@"Something"); without a single hiccup.

Solution 2

Solved!

1.) Restarted my computer

2.) Deleted the app from the phone

3.) Debug

Share:
14,162
GabourX
Author by

GabourX

A software engineer Student

Updated on June 27, 2022

Comments

  • GabourX
    GabourX almost 2 years

    I am developing an app for Windows Phone 8 with C#

    And I've been working alot with MessageBox.Show() , and All the time it used to show a PopUp message like i wanted , but then suddenly , it Won't show anything , I debugged the app , the code runs normally and compiles the Line MessageBox.Show("Something"); but it doesn't pop up !

    I also tried to put it in another page , doesn't work too ! All i remember that yesterday I have messed with References of the Project But is that the problem ?

    Anyways here's a photo of the references of my Project

    References

  • GabourX
    GabourX almost 10 years
    Where i can add assemblies?
  • GabourX
    GabourX almost 10 years
    Followed till step 4 , and there's was nothing to choose there Only a message was showen :All of framework assemblies are already referenced . Please use the object browser to explore the references in the Framework
  • GabourX
    GabourX almost 10 years
    went to the Objcet Browser , found System.Windows and also found MessageBox class
  • GabourX
    GabourX almost 10 years
    but again , The windows in your picture doesn't show any assembly in my computer
  • GabourX
    GabourX almost 10 years
    2012 Express for Windows Phone
  • GabourX
    GabourX almost 10 years
    I told you , its Targeting : Windows Phone 8.0
  • AMS
    AMS almost 10 years
    you cannot add framework assemblies for the windows phone 8 apps. all the framework assemblies are already referenced in windows phone 8 solutions implicitly.
  • Greg
    Greg almost 10 years
    @DreamCoder Fixed the answer to better define "steps".
  • GusP
    GusP about 9 years
    Along these lines, I ended up just rebooting my phone and it started working again. Apparently, this is a Windows Phone 8.1 bug and not actually a problem with apps that run into this.