when my prog tries to open a filedialog to open a .txt file, when
it fails to open it eg: when file is open or in used. It crashes,
anyway to turn around this. so that it can prompt an error msg
when the .txt file is not valid or not of a proper format instead
of crashing. also is it somehow possible to ensure the user opens
only .txt files else it will prompt, file not valid.
Private Sub btnFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFileOpen.Click
ofdFile.Filter = "txt Files (*.txt)|*.txt|All Files (*.*)|*.*"
ofdFile.DefaultExt = "txt"
If ofdFile.ShowDialog() = DialogResult.Cancel Then
Return
End If
it fails to open it eg: when file is open or in used. It crashes,
anyway to turn around this. so that it can prompt an error msg
when the .txt file is not valid or not of a proper format instead
of crashing. also is it somehow possible to ensure the user opens
only .txt files else it will prompt, file not valid.
Private Sub btnFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFileOpen.Click
ofdFile.Filter = "txt Files (*.txt)|*.txt|All Files (*.*)|*.*"
ofdFile.DefaultExt = "txt"
If ofdFile.ShowDialog() = DialogResult.Cancel Then
Return
End If