How To Open A File + Sourabh Das
-
Hi All, I have a text box in which a file path is displayed. A button to click and open the file. Code executes properly but the file dosent open. Here is the Code:
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Try
strIOPath = ucFile.TxtCode.Text
If strIOPath = "" Then
ShowMessage("No File For This Transaction")
Exit Sub
End If
If IO.File.Exists(strIOPath) Then
File.Open(strIOPath, FileMode.Create)
Else
ShowMessage("File Not Found")
End If
Catch ex As Exception
ShowMessage(ex.Message)
End Try
End SubThanks and Regards,
-
Hi All, I have a text box in which a file path is displayed. A button to click and open the file. Code executes properly but the file dosent open. Here is the Code:
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Try
strIOPath = ucFile.TxtCode.Text
If strIOPath = "" Then
ShowMessage("No File For This Transaction")
Exit Sub
End If
If IO.File.Exists(strIOPath) Then
File.Open(strIOPath, FileMode.Create)
Else
ShowMessage("File Not Found")
End If
Catch ex As Exception
ShowMessage(ex.Message)
End Try
End SubThanks and Regards,
-
Hi All, I have a text box in which a file path is displayed. A button to click and open the file. Code executes properly but the file dosent open. Here is the Code:
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Try
strIOPath = ucFile.TxtCode.Text
If strIOPath = "" Then
ShowMessage("No File For This Transaction")
Exit Sub
End If
If IO.File.Exists(strIOPath) Then
File.Open(strIOPath, FileMode.Create)
Else
ShowMessage("File Not Found")
End If
Catch ex As Exception
ShowMessage(ex.Message)
End Try
End SubThanks and Regards,
hi, if
File.Open
does not do what you expect, then maybe your expectations are incorrect. Go and check the documentation. That is what it is for. :)Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets