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
 
Back
Top