On windows 7 (32 bit) had same problem when showing the openfiledialog from a modal form loaded for the second time with data from db in it. Solution appeared to be: do not allow autoupgrade of dialog.
Dim sfv As New System.Windows.Forms.SaveFileDialog
With sfv
.AutoUpgradeEnabled = False
[...]
But error came up again. Then I noticed it was apparently randomic till I realized it did not come out ifd I was able to show a saveFileDialog or an OpenfileDialog before loading any data from db.
Thus true workaround is: before load anything on the form you're going to show, display a dialog asking user to choose a path and file you *might* need after (arrrg!). After that, load data. Now your can let users, if needed, to choose path and file with dialog again...
ie:
Private Sub frmReport_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtFilePathName.Text = "Export_" & Now.ToString("yyyy_MM_dd_HH_mm_ss", CultureInfo.GetCultureInfo("it-It")) & ".csv"
txtFilePathName.Text = GetSaveFileName(txtFilePathName.Text, ".csv", "Choose a csv File to save exported data", "csv |*.csv|All |*.*")
'now load data in forms, where you can also have a button to call again the GetSaveFileName
[...].Private Function GetSaveFileName(ByVal fileName As String,
ByVal defaultExtension As String,
ByVal title As String,
ByVal filter As String) As String
Dim sfv As New System.Windows.Forms.SaveFileDialog
With sfv
.RestoreDirectory = True
.AddExtension = True
.DefaultExt = defaultExtension
.FileName = fileName
.Title = title
.Filter = filter
.CheckPathExists = True
.OverwritePrompt = True
.ShowHelp = False
If (.ShowDialog = DialogResult.OK) Then
fileName = .FileName
End If
End With
Return fileName
End Function
Cimperiali