Problem attaching a sql database to a vb,net app

I have a SQL datafile that I am trying to attach to a VB.NET application. The problems are, 1) The first time I try it I get an error that says it cannot create the .ldf file because a .ldf file already exists. So, I delete the .ldf file and went back and attempted to attach the database and I get a file open in another app. So, 2) not knowing where the file is open at, I restarted my computer and attempted to attach, again, and still get the file open in another app error. I have no idea what the problem is,