user3639140
user3639140

Reputation: 3

How to open a specific file without user selection?

I currently have the following code which allows a user to select a file:

  Private Sub FileToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles FileToolStripMenuItem1.Click
    Dim result As DialogResult
    Using filechooser As New OpenFileDialog()
        result = filechooser.ShowDialog()
        playFile = filechooser.FileName
    End Using
End Sub

What I am trying to do is have the program open a file on its own without user selection. Basically, i have a generic file that needs to be used for the application regardless of who is using it, and I want it to be uploaded automatically upon the application being started.

Upvotes: 0

Views: 33

Answers (1)

JimmyD
JimmyD

Reputation: 154

You could just simply point your PlayFile directly by specifying the file

playFile = "C:\yourfile.txt" 'point to your file here

Upvotes: 2

Related Questions