openfiledialog does not return OK?

  • 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?
 
A valid statement would be:-

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

Peter
 

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