Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. openFileDialog - AccessViolationException was unhandled

openFileDialog - AccessViolationException was unhandled

Scheduled Pinned Locked Moved Managed C++/CLI
performancehelp
3 Posts 2 Posters 11 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paramu1973
    wrote on last edited by
    #1

    Hi, Iam using Vs2015, While I try to Open a file using OpenFileDialog, Iam receiving the error "Unhandled exception of type" System.AccessViolationException" occoured in system.windows.forms.dll Additional information: Attempted to read or write protected memory.This is often an indication other memory is currupt. My Codes

    System::Windows::Forms::OpenFileDialog^ MyFileOpenDialog = gcnew System::Windows::Forms::OpenFileDialog();
    MyFileOpenDialog->Title = "Select Your Excel Test File";
    MyFileOpenDialog->InitialDirectory = "C:\\";
    MyFileOpenDialog->Filter = "Excel Files (*.xls)|*.xls|All files (*.*)|*.*";
    MyFileOpenDialog->FilterIndex = 2;
    MyFileOpenDialog->RestoreDirectory = true;
    if (MyFileOpenDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK) {
    MyExcelFile = MyFileOpenDialog->FileName;
    }

    I cannot understand my mistake ! Thanks For the helps!:thumbsup: Richard pls. advise me! Thank again !

    V 1 Reply Last reply
    0
    • P Paramu1973

      Hi, Iam using Vs2015, While I try to Open a file using OpenFileDialog, Iam receiving the error "Unhandled exception of type" System.AccessViolationException" occoured in system.windows.forms.dll Additional information: Attempted to read or write protected memory.This is often an indication other memory is currupt. My Codes

      System::Windows::Forms::OpenFileDialog^ MyFileOpenDialog = gcnew System::Windows::Forms::OpenFileDialog();
      MyFileOpenDialog->Title = "Select Your Excel Test File";
      MyFileOpenDialog->InitialDirectory = "C:\\";
      MyFileOpenDialog->Filter = "Excel Files (*.xls)|*.xls|All files (*.*)|*.*";
      MyFileOpenDialog->FilterIndex = 2;
      MyFileOpenDialog->RestoreDirectory = true;
      if (MyFileOpenDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK) {
      MyExcelFile = MyFileOpenDialog->FileName;
      }

      I cannot understand my mistake ! Thanks For the helps!:thumbsup: Richard pls. advise me! Thank again !

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      Answered in CG Forum: [openFileDialog - AccessViolationException was unhandled](https://forums.codeguru.com/showthread.php?565616-openFileDialog-AccessViolationException-was-unhandled&p=2240072#post2240072)

      P 1 Reply Last reply
      0
      • V Victor Nijegorodov

        Answered in CG Forum: [openFileDialog - AccessViolationException was unhandled](https://forums.codeguru.com/showthread.php?565616-openFileDialog-AccessViolationException-was-unhandled&p=2240072#post2240072)

        P Offline
        P Offline
        Paramu1973
        wrote on last edited by
        #3

        Thank Victor:rose::thumbsup:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups