My project utilizes a DataGridView that retrieves its data from an Access database file. Is there a "snippet" of code available that prompts the user to locate the database file should it be removed or renamed that will overwrite the connection strings used to create the project's Data Source.

If Not System.IO.File.Exists("<path and filename>") Then
   If MessageBox.Show("The database file cannot be found. Would you like to browse for it?","Missing database file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
      'Create an OpenFileDialog here and use the path for the connection string
   Else
      Return
   End If
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.