Shermine
Shermine

Reputation: 7

Open Access file with button click

Is it possible to open my Microsoft Access file with just a button click event?

The tutorials I read online has to go through OpenFileDialog but I do not want that. I want to open the file directly with a click of a button.

File Location: C:\Users\User\Documents\MedicalRecord.accdb

Upvotes: 1

Views: 1135

Answers (2)

jmc
jmc

Reputation: 1729

You can use Process.Start(), it's the same thing as double-clicking your file directly.

 private void button1_Click(object sender, EventArgs e)
 {
     Process.Start(@"C:\Users\User\Documents\MedicalRecord.accdb");
 }

Upvotes: 2

Anis Sivasankaran
Anis Sivasankaran

Reputation: 21

Yes, it is possible, instead of using open file dialog's file name, use the file location you want

Upvotes: 0

Related Questions