Is this a VB.Net 2003 Bug??

  • Thread starter Thread starter GrandpaB
  • Start date Start date
G

GrandpaB

I'm running VB.Net 2003 & I think that I have found
a .Net BUG!!!

If I invoke the OpenFileDialog in my application, neither
the SOAPFormatter nor the BinaryFormatter will write the
output file when the application closes.

If I manually edit the textbox, instead of using the
OpenFileDialog, either the SOAPFormatter or the
BinaryFormatter will write the outputfile when the
application closes.

The OpenFileDialog is invoked from by double clicking a
picture box, pbPict. Here is the event handler for the
picture box.

Private Sub pbPict_DoubleClick(ByVal sender _
As Object, ByVal e As System.EventArgs) _
Handles pbPict.DoubleClick
If jpgDialog.ShowDialog = DialogResult.OK Then
tbFileName.Text = jpgDialog.FileName
End If
End Sub

I have made two previous submissions to this newsgroup on
this problem. Because of the previous discussions I have
reduced the application down to the essentials that
produce the error.

Any insight would be greatly appreciated, GrandpaB
 
I was just playing around with the FolderBrowserDialog and was getting odd
behaviour on exiting my app.

I found that instead of adding the dialog via the designer, if I created it
in the routine that I was using it in, and disposed of it when I had
finished with it, the fault no longer occurred. I had other problems with it
though such as it allowing me to select a Network Path and then giving me
the error "The given path's format is not supported." when I tried to use
it, but I can work around that.

Does this do the same for you?

Private Sub pbPict_DoubleClick(ByVal sender _
As Object, ByVal e As System.EventArgs) _
Handles pbPict.DoubleClick
Dim jpgDialog As New OpenFileDialog
jpgDialog.Filter = "JPEG files|*.jpg"
If jpgDialog.ShowDialog = DialogResult.OK Then
tbFileName.Text = jpgDialog.FileName
End If
jpgDialog.Dispose()
End Sub
 
Mick,

Thanks for your reply. I'm glad to hear that I'm not the
only one who has experienced wierd results.

I pasted your code into my aplication, but unfortunately
the error remains.

GrandpaB
 
GrandpaB said:
If I invoke the OpenFileDialog in my application, neither
the SOAPFormatter nor the BinaryFormatter will write the
output file when the application closes.

If I manually edit the textbox, instead of using the
OpenFileDialog, either the SOAPFormatter or the
BinaryFormatter will write the outputfile when the
application closes.

OpenFileDialog may change the current directory. Did you already try to use
absolute paths with your 'SOAPFormatter' and 'BinaryFormatter'?
 
Herfried,

Eureka, eureka, you found it Mr. MVP. I have not yet
worked out a solution, but the output files have been
written to the same directory from which the images were
opened.

I imagine that I'll have to save the current directory
after I read the data file and restore it before I write
it. The VB texts I read did not mention this detail or
if they did it escaped my attention.

Thankyou, thankyou, thankyou, GrandpaB
 
GrandpaB said:
Eureka, eureka, you found it Mr. MVP. I have not yet
worked out a solution, but the output files have been
written to the same directory from which the images were
opened.

I imagine that I'll have to save the current directory
after I read the data file and restore it before I write
it. The VB texts I read did not mention this detail or
if they did it escaped my attention.

You may want to set the OpenFileDialog's 'RestoreDirectory' property to
'True'. This will reset the current directory prior to closing the dialog.
 
Back
Top