showdialog and return values

J

Joerg Trumpfheller

Hi folks,

Don't know how to get info about the second dialog which appears after
clicking a button of the first dialog.

following situation:

Dim saveMode As Boolean
Dim saveFileDialog1 As New SaveFileDialog()

' if I clicking the ok button, set value true, pdfreport will be created

If (saveFileDialog1.ShowDialog() = DialogResult.OK) Then
saveMode = True
Else
saveMode = False
End If

for the first time running this it works fine. The next time I start and
click the ok button a new dialog appears with a message "File already
exists, Override Yes/No". After clicking yes the programm runs on at the
else mode, so the saveMode var is set to false.

How can I ask for return values of the second dialog? Any idea?

Joerg
 
C

Cor

Hi Joerg,

I did look very long, but I only see one showdialog.

Is there something missing in your message or am I seeing something not (not
impossible)?.

Cor
 
J

Joerg Trumpfheller

Hello Cor,

the second dialog I mean appears automatically by system (dialog - "File
already exists ... Override Yes/no")

Joerg
 
C

Cor

Hi Joerg,

Do you if you restart the program the same effect when you select an already
existing file?

I did never test this, but I am thinking about something that the pdf file
is not yet closed, so it cannot be overwritten.

Cor
 
H

Herfried K. Wagner [MVP]

* "Joerg Trumpfheller said:
Don't know how to get info about the second dialog which appears after
clicking a button of the first dialog.

following situation:

Dim saveMode As Boolean
Dim saveFileDialog1 As New SaveFileDialog()

' if I clicking the ok button, set value true, pdfreport will be created

How do you create the PDF report?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
J

Joerg Trumpfheller

Hi,

I have referenced a PdfCreatorLibrary (PdfCreatorLib.dll - Version
1.0.1284.20348 - Copyright(c) Serdar Dirican) and this creates the report

Joerg
 
J

Joerg Trumpfheller

I think I will do it that way:

Before opening the saveasdialog I ask
if System.IO.File.Exists(file to create).
If is so system.io.file.delete(..)
This works, but not the normal way I think.

Joerg
 
C

Cor

Hi Joerg,
When you know what file to delete, you also know what file to write, than
you don't need the filesave dialog at all I think, something strange..

Cor
 
J

Joerg Trumpfheller

hi cor,

customers sometimes have to decide, if they use subfolders for save.
Therefore the savefiledialog.

Joerg
 
C

Cor

Hi Joerg,

Customers are always king, but when you first delete the file and then give
them the change to save another one.

Or did I misunderstood you?

Cor
 
J

Joerg Trumpfheller

Hy Cor,

anyway I don't know how to manage my first described problem. I think it
also wil happen to a standard savefiledialog, if the file you want to save
already exists. In excel this is an error with a errornumber and I can react
for this. With this example I don't know what to do. Some more ideas?

Joerg
 
T

Tom Leylan

Joerg Trumpfheller said:
anyway I don't know how to manage my first described problem.

I think something else is up... the dialog code you posted works fine. Did
you happen to trace the code, the results of the test work as far as I can
see.

Tom
 
J

Joerg Trumpfheller

Hey helpers,

I think I have found the problem. The problem is called Microsoft. :)
Read here and you know why
http://support.microsoft.com/default.aspx?scid=kb;en-us;327213

Thanks for help

--
Best wishes
Joerg
... any % of U is as good as the whole pie ...
__________________________________________________________
E-Mail: (e-mail address removed); (e-mail address removed) (Home)
Homepage: http://www.jtrumpfheller.com; http://jtrumpfheller.com
__________________________________________________________
 
C

Cor

Thanks Joerg,

Till now I did never use a module, but I am glad you did show it to us.
(A reason more to avoid it)

Thanks,

Cor
 
J

Joerg Trumpfheller

Hy people,

I was looking for some more msgs describing the same problem. It is
described in detail under the subject savefiledialog. In the MSDN -
Konowledge base is an article under
http://support.microsoft.com/default.aspx?scid=kb;en-us;327213
So all answers I get did ot solve the problem. Clicking Ok and the file
exists returns a dialogresult.cancel no matter if you they yes or no for
overwrite.

Thanks for help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top