10 Replies - 494 Views - Last Post: 21 July 2014 - 09:48 AM Rate Topic: -----

#1 puuts  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 20-May 13

.ShowDialog - AccessViolationException was unhandled

Posted 16 July 2014 - 07:50 AM

Hello Gurus,

I have the below code to save an image.

Dim SaveFileDIalog1 As New SaveFileDialog()

SaveFileDialog1.Filter = "Jpeg Image|*.jpg|Bitmap Image|*.bmp
SaveFileDialog1.Title = "Save an Image File"
SaveFileDialog1.ShowDialog()



I've tried to debug my code, and it get an error on line:
[b][u]SaveFileDialog1.ShowDialog()[/b][/u]



I'm using MS Access 2010 as my database and VS 2012. I've research on the internet on how to resolve this but all the answers that they've provided still can't sort it out my problem.

Is there an issue with MS Access 2010 for this kind of error? Coz' I've read that there is a bug on MS Access 2010.

Is This A Good Question/Topic? 0
  • +

Replies To: .ShowDialog - AccessViolationException was unhandled

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3526
  • View blog
  • Posts: 12,034
  • Joined: 12-December 12

Re: .ShowDialog - AccessViolationException was unhandled

Posted 16 July 2014 - 10:45 AM

AccessViolationException has nothing to do with the Microsoft Access application.

What sort of application are you running this in? A WinForm?

I think you should provide some more relevant code as I'm doubtful that that code snippet gives the full picture. Just copy and paste the code, don't attempt to edit it before posting.
Was This Post Helpful? 0
  • +
  • -

#3 puuts  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 20-May 13

Re: .ShowDialog - AccessViolationException was unhandled

Posted 16 July 2014 - 11:47 AM

Hi Andrew,

Yes, I'm running this in a WinForm application.
Actually, I'm trying to use the 'SaveFileDialog' function with database connected (MS ACCESS 2010; Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\Test;). The above example is the code that use. When I tried to run and debug step by step the code, when it hits line
SaveFileDialog1.ShowDialog() 



the error occurs. To make sure that the code works, I've make another application without connected to database (MS ACCESS 2010) and use the same code, and luckily it works. If you have an MS ACCESS 2010, could you please give it a try to run the same code with connected to database? Please use Provider=Microsoft.ACE.OLEDB.12.0;

I have read that there is a bug on MS ACCESS 2010, but all they're answers didn't sort it out with my problem.

Thanks in advance.

This post has been edited by andrewsw: 16 July 2014 - 11:50 AM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#4 xD@t0m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 61
  • Joined: 13-May 14

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 08:54 AM

My guess is that SaveFileDialog1.ShowDialog() returns a value. You can try this:
If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
    'Do something
End If

Was This Post Helpful? 1
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2264
  • View blog
  • Posts: 9,470
  • Joined: 29-May 08

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:11 AM

The user may not have Write Access to C:\Test

This post has been edited by AdamSpeight2008: 21 July 2014 - 09:13 AM

Was This Post Helpful? 1
  • +
  • -

#6 xD@t0m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 61
  • Joined: 13-May 14

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:16 AM

View PostAdamSpeight2008, on 21 July 2014 - 09:11 AM, said:

The user may not have Write Access to C:\Test


I'd understand if it was C:\Windows, or C:\Users\{Username}, but it's not likely for the user not to have access to C:\Test.
Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3526
  • View blog
  • Posts: 12,034
  • Joined: 12-December 12

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:21 AM

The Data Source should include the extension, "C:\Test.accdb", but perhaps this was just omitted when posting.
Was This Post Helpful? 1
  • +
  • -

#8 xD@t0m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 61
  • Joined: 13-May 14

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:25 AM

View Postandrewsw, on 21 July 2014 - 09:21 AM, said:

The Data Source should include the extension, "C:\Test.accdb", but perhaps this was just omitted when posting.

That's where the confusion is, C:\Test could be an folder or file.
Was This Post Helpful? 0
  • +
  • -

#9 IronRazer  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 295
  • View blog
  • Posts: 925
  • Joined: 01-February 13

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:29 AM

Yes, the newer OS`s are quite restrictive on letting the user create files on the Root drive or in a few other special folders like the Programs folder or Windows folder. They do that for security reasons. I can`t count how many times i have seen that problem on the forums in the last few years.
Was This Post Helpful? 0
  • +
  • -

#10 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3526
  • View blog
  • Posts: 12,034
  • Joined: 12-December 12

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:37 AM

I rarely put anything directly on the C: drive anyway ;) apart from those odd apps that seem to insist on it. A lot of companies don't allow this either.
Was This Post Helpful? 0
  • +
  • -

#11 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2264
  • View blog
  • Posts: 9,470
  • Joined: 29-May 08

Re: .ShowDialog - AccessViolationException was unhandled

Posted 21 July 2014 - 09:48 AM

The Programs should be treated as Read-Only. During your application installation only store Short-Cuts.

Program
 -DIC
  -Woot.shortcut --> Program Files \ DIC \ Woot \ Woot.Exe


Both folders should follow the following structure.
Company
 Program
  Common
  Version


If your application has / creates data, create a folder inside APPDATA
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1