OpenFileDialog problem

  • Thread starter Thread starter deBeuk
  • Start date Start date
D

deBeuk

I am totally confused !!

Although I am a novice in VB.NET and PDA programming, coding below
appears to be correct.

If OpenFiledialog1.ShowDialog.Cancel Then
txtTaxcode.Text = "No selection made"
Exit Sub
End If
If OpenFiledialog1.ShowDialog() = DialogResult.OK Then
txtTaxcode.Text = "OK!"
Exit Sub
End If

but always the text shown at Cancel appears. Who can help me with
this? Is it due to the fact that there is no OK button on the
Showdialog, and I select the file by clicking?
 
Hi,

Try something like this instead.

Dim dr As DialogResult = OpenFileDialog1.ShowDialog

Select Case dr

Case DialogResult.OK

MessageBox.Show("OK")

Case DialogResult.Cancel

MessageBox.Show("Cancel")

End Select



Ken
 
Ken,

This works, thanks!

I can now work on the mistakes resulting from this one:
1. I have to select the file (or cancel) twice before reactin
2. The file name including path is shown now

Any ideas?

Op Wed, 28 Jan 2004 10:32:39 -0500 schreef "Ken Tucker [MVP]"
 
* deBeuk said:
This works, thanks!

I can now work on the mistakes resulting from this one:
1. I have to select the file (or cancel) twice before reactin
2. The file name including path is shown now

Any ideas?

What's the question?
 

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

Back
Top